You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/10/15 03:49:39 UTC

[GitHub] [spark] yaooqinn opened a new pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

yaooqinn opened a new pull request #30045:
URL: https://github.com/apache/spark/pull/30045


   
   ### What changes were proposed in this pull request?
   
   ####  case
   
   the case here covers the static and dynamic SQL configs behavior in `sharedState` and `sessionState`,  and the specially handled config `spark.sql.warehouse.dir`
   
   ```scala
   
   import java.lang.reflect.Field
   
   import org.apache.spark.sql.SparkSession
   import org.apache.spark.{SparkConf, SparkContext}
   
   object WarehouseSCBeforeSS extends App {
   
     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 confField: Field = spark.sharedState.getClass.getDeclaredField("conf")
     confField.setAccessible(true)
     private val shared: SparkConf = confField.get(spark.sharedState).asInstanceOf[SparkConf]
     println()
     println(s"=====> SharedState: $wh=${shared.get(wh)}")
     println(s"=====> SharedState: $td=${shared.get(td)}")
     println(s"=====> SharedState: $custom=${shared.get(custom, "")}")
   
     println(s"=====> SessionState: $wh=${spark.conf.get(wh)}")
     println(s"=====> SessionState: $td=${spark.conf.get(td)}")
     println(s"=====> SessionState: $custom=${spark.conf.get(custom, "")}")
   
     val spark2 = SparkSession.builder().config(td, "fred").getOrCreate()
   
     println(s"=====> SessionState 2: $wh=${spark2.conf.get(wh)}")
     println(s"=====> SessionState 2: $td=${spark2.conf.get(td)}")
     println(s"=====> SessionState 2: $custom=${spark2.conf.get(custom, "")}")
   
     SparkSession.setActiveSession(spark)
     spark.sql("RESET")
   
     println(s"=====> SessionState RESET: $wh=${spark.conf.get(wh)}")
     println(s"=====> SessionState RESET: $td=${spark.conf.get(td)}")
     println(s"=====> SessionState RESET: $custom=${spark.conf.get(custom, "")}")
   
     val spark3 = SparkSession.builder().getOrCreate()
   
     println(s"=====> SessionState 3: $wh=${spark2.conf.get(wh)}")
     println(s"=====> SessionState 3: $td=${spark2.conf.get(td)}")
     println(s"=====> SessionState 3: $custom=${spark2.conf.get(custom, "")}")
   }
   ```
   
   #### outputs and analysis
   ```
   // 1. Make the cloned spark conf in shared state respect the warehouse dir from the 1st SparkSession
   //=====> SharedState: spark.sql.warehouse.dir=./data1
   // 2. ⏬
   //=====> SharedState: spark.sql.globalTempDatabase=alice
   //=====> SharedState: spark.sql.custom=kyao
   //=====> SessionState: spark.sql.warehouse.dir=./data2
   //=====> SessionState: spark.sql.globalTempDatabase=alice
   //=====> SessionState: spark.sql.custom=kyao
   //=====> SessionState 2: spark.sql.warehouse.dir=./data2
   //=====> SessionState 2: spark.sql.globalTempDatabase=alice
   //=====> SessionState 2: spark.sql.custom=kyao
   // 2'.🔼 OK until here
   // 3. Make the below 3 ones respect the cloned spark conf in shared state with issue 1 fixed
   //=====> SessionState RESET: spark.sql.warehouse.dir=./data1
   //=====> SessionState RESET: spark.sql.globalTempDatabase=bob
   //=====> SessionState RESET: spark.sql.custom=
   // 4. Then the SparkSessions created after RESET will be corrected.
   //=====> SessionState 3: spark.sql.warehouse.dir=./data1
   //=====> SessionState 3: spark.sql.globalTempDatabase=bob
   //=====> SessionState 3: spark.sql.custom=
   ```
   
   In this PR, we gather all valid config to the cloned conf of `sharedState` during being constructed, well, actually only `spark.sql.warehouse.dir` is missing. Then we use this conf as defaults for `RESET` Command.
   
   `SparkSession.clearActiveSession/clearDefaultSession` will make the shared state invisible and unsharable. They will be internal only soon (confirmed with Wenchen), so cases with them called will not be a problem.
   
   ### Why are the changes needed?
   <!--
   Please clarify why the changes are needed. For instance,
     1. If you propose a new API, clarify the use case for a new API.
     2. If you fix a bug, you can clarify why it is a bug.
   -->
   
   bugfix for programming API to call RESET while users creating SparkContext first and config SparkSession later.
   
   ### Does this PR introduce _any_ user-facing change?
   <!--
   Note that it means *any* user-facing change including all aspects such as the documentation fix.
   If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
   If possible, please also clarify if this is a user-facing change compared to the released Spark versions or within the unreleased branches such as master.
   If no, write 'No'.
   -->
   
   yes, before this change when you use programming API and call RESET, all configs will be reset to  SparkContext.conf, now they go to SparkSession.sharedState.conf
   
   ### How was this patch tested?
   <!--
   If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
   If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
   If tests were not added, please describe why they were not added and/or why it was difficult to add.
   -->
   new tests


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-714721394


   Merged build finished. Test FAILed.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] yaooqinn commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
yaooqinn commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-709878145


   cc @hvanhovell too


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-714930133


   GA passed, merging to master, thanks!


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-714627732






----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-710114143


   **[Test build #129900 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/129900/testReport)** for PR 30045 at commit [`91c2e91`](https://github.com/apache/spark/commit/91c2e91b3c6133951a44214911ede8e51ffc07fa).


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-714885443


   Kubernetes integration test status success
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/34786/
   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-714973888


   **[Test build #130184 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/130184/testReport)** for PR 30045 at commit [`d194796`](https://github.com/apache/spark/commit/d1947961a366cd76086b9996c4d9687b7c63f3f7).
    * This patch passes all tests.
    * This patch merges cleanly.
    * This patch adds no public classes.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-714876806


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/34786/
   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-709015902


   Kubernetes integration test status success
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/34420/
   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] yaooqinn commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
yaooqinn commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-739697379


   > @yaooqinn active session is a thread local. What if we create a new session in another thread?
   
   w/o  `SparkSession.clearDefaultSession()`,  we will not create a new one
   
   ![image](https://user-images.githubusercontent.com/8326978/101316487-8525db80-3897-11eb-8c32-08a6b1909f4a.png)
   
   w/ `SparkSession.clearDefaultSession()`, the shared state is also not able to reach
   
   ![image](https://user-images.githubusercontent.com/8326978/101316649-dcc44700-3897-11eb-8ebe-ddabc207d07c.png)
   
   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-727824653


   makes sense. @yaooqinn what do you think?


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a change in pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] yaooqinn commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
yaooqinn commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-708947284


   cc @cloud-fan @maropu @gatorsmile thanks~


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] yaooqinn removed a comment on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
yaooqinn removed a comment on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-739694075


   > @yaooqinn active session is a thread local. What if we create a new session in another thread?
   
   In this case, then  we have to clean the default session ahead


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-709985337






----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a change in pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #30045:
URL: https://github.com/apache/spark/pull/30045#discussion_r510014126



##########
File path: sql/hive/src/test/scala/org/apache/spark/sql/hive/HiveSharedStateSuite.scala
##########
@@ -20,35 +20,45 @@ package org.apache.spark.sql.hive
 import org.apache.hadoop.hive.conf.HiveConf.ConfVars
 
 import org.apache.spark.{SparkConf, SparkContext, SparkFunSuite}
-import org.apache.spark.sql.internal.SharedState
+import org.apache.spark.sql.SparkSession
 import org.apache.spark.sql.internal.StaticSQLConf._
 import org.apache.spark.util.Utils
 
 class HiveSharedStateSuite extends SparkFunSuite {
 
+  override def beforeEach(): Unit = {
+    SparkSession.clearActiveSessionInternal()
+    SparkSession.clearDefaultSession()
+    super.beforeEach()
+  }
+
   test("initial configs should be passed to SharedState but not SparkContext") {
     val conf = new SparkConf().setMaster("local").setAppName("SharedState Test")
     val sc = SparkContext.getOrCreate(conf)
+    val wareHouseDir = Utils.createTempDir().toString
     val invalidPath = "invalid/path"
     val metastorePath = Utils.createTempDir()
     val tmpDb = "tmp_db"
 
     // The initial configs used to generate SharedState, none of these should affect the global

Review comment:
       this is wrong now, as warehouse conf is an exception.




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-709909596






----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-714885452






----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-714428437


   Kubernetes integration test status success
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/34757/
   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-709179343






----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-714442719






----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a change in pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #30045:
URL: https://github.com/apache/spark/pull/30045#discussion_r510177073



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/internal/SharedState.scala
##########
@@ -254,9 +258,10 @@ object SharedState extends Logging {
       // the value of spark.sql.warehouse.dir.
       // When neither spark.sql.warehouse.dir nor hive.metastore.warehouse.dir is set
       // we will set hive.metastore.warehouse.dir to the default value of spark.sql.warehouse.dir.
-      val sparkWarehouseDir = sparkConf.get(WAREHOUSE_PATH)
+      val sparkWarehouseDir = sparkWarehouse.getOrElse(sparkConf.get(WAREHOUSE_PATH))

Review comment:
       can we change to `sparkWarehouse.getOrElse(WAREHOUSE_PATH.defaultValueString)` so that it's more explicit?




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-739657825


   @yaooqinn active session is a thread local. What if we create a new session in another thread?


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA removed a comment on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-714584120


   **[Test build #130166 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/130166/testReport)** for PR 30045 at commit [`d194796`](https://github.com/apache/spark/commit/d1947961a366cd76086b9996c4d9687b7c63f3f7).


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-714428464






----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-708906926


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/34400/
   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] yaooqinn commented on a change in pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
yaooqinn commented on a change in pull request #30045:
URL: https://github.com/apache/spark/pull/30045#discussion_r510014068



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/internal/SharedState.scala
##########
@@ -254,9 +258,10 @@ object SharedState extends Logging {
       // the value of spark.sql.warehouse.dir.
       // When neither spark.sql.warehouse.dir nor hive.metastore.warehouse.dir is set
       // we will set hive.metastore.warehouse.dir to the default value of spark.sql.warehouse.dir.
-      val sparkWarehouseDir = sparkConf.get(WAREHOUSE_PATH)
+      val sparkWarehouseDir = sparkWarehouse.getOrElse(sparkConf.get(WAREHOUSE_PATH))

Review comment:
       Yes, here will  finally touch the default value string if never matched before




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA removed a comment on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-709878764


   **[Test build #129883 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/129883/testReport)** for PR 30045 at commit [`6848b2f`](https://github.com/apache/spark/commit/6848b2fed2be7137f4133bb7ec1790b9aad1ba29).


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] yaooqinn commented on a change in pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
yaooqinn commented on a change in pull request #30045:
URL: https://github.com/apache/spark/pull/30045#discussion_r506343027



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/command/SetCommand.scala
##########
@@ -172,7 +172,7 @@ object SetCommand {
 case class ResetCommand(config: Option[String]) extends RunnableCommand with IgnoreCachedData {
 
   override def run(sparkSession: SparkSession): Seq[Row] = {
-    val defaults = sparkSession.sparkContext.conf
+    val defaults = sparkSession.sharedState.conf

Review comment:
       No. The `sharedState.conf` is a cloned `sparkContext.conf` with other initial options including the warehouse dir and other static/dynamic configs set by the 1st SparkSession instance which creates the one and only `sharedState`. 
   If there is existing sc when we create the 1st SparkSession (e.g. see the PR description), the initial configs will go to the `sharedState.conf`, and we use this version of conf as defaults. Also, later created SparkSession with other options will not affect the `sharedState.conf`




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-714627700


   Kubernetes integration test status success
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/34773/
   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-709179343






----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] yaooqinn commented on a change in pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
yaooqinn commented on a change in pull request #30045:
URL: https://github.com/apache/spark/pull/30045#discussion_r506354101



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/internal/SharedState.scala
##########
@@ -55,10 +55,11 @@ private[sql] class SharedState(
 
   SharedState.setFsUrlStreamHandlerFactory(sparkContext.conf, sparkContext.hadoopConfiguration)
 
-  private val (conf, hadoopConf) = {
+  private[sql] val (conf, hadoopConf) = {
     // Load hive-site.xml into hadoopConf and determine the warehouse path which will be set into
     // both spark conf and hadoop conf avoiding be affected by any SparkSession level options
-    SharedState.loadHiveConfFile(sparkContext.conf, sparkContext.hadoopConfiguration)
+    SharedState.loadHiveConfFile(
+      sparkContext.conf, sparkContext.hadoopConfiguration, initialConfigs)

Review comment:
       I updated the test case a bit, FYI https://github.com/yaooqinn/sugar/blob/master/src/main/scala/com/netease/mammut/spark/training/sql/WarehouseSCBeforeSS.scala#L67
   
   'data2' is expected




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-709015932






----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-708991196






----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-709984802


   **[Test build #129883 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/129883/testReport)** for PR 30045 at commit [`6848b2f`](https://github.com/apache/spark/commit/6848b2fed2be7137f4133bb7ec1790b9aad1ba29).
    * This patch **fails Spark unit tests**.
    * This patch merges cleanly.
    * This patch adds the following public classes _(experimental)_:
     * `  public static class Bitmaps `
     * `  public static class BitmapArrays `
     * `  class BlockPushErrorHandler implements ErrorHandler `
     * `public class MergedBlockMeta `
     * `public class OneForOneBlockPusher `
     * `public class FinalizeShuffleMerge extends BlockTransferMessage `
     * `public class MergeStatuses extends BlockTransferMessage `
     * `public class PushBlockStream extends BlockTransferMessage `


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a change in pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #30045:
URL: https://github.com/apache/spark/pull/30045#discussion_r510015561



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/SparkSessionBuilderSuite.scala
##########
@@ -300,4 +300,58 @@ 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()
+
+    // When creating the first session like above, we will update the shared spark conf to the
+    // newly specified values
+    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,
+      "The warehouse dir in session conf and shared state conf should be consistent")
+    assert(spark.conf.get(td) === sharedTD,
+      "Static sql configs in session conf and shared state conf should be consistent")
+    assert(spark.conf.get(custom) === sharedCustom,

Review comment:
       This is surprising.  According to https://github.com/apache/spark/pull/30045/files#diff-a46d1554470fd92f71a46b01bb07a21f159a3e521c4b7dc72dbf9a5060e25dbdR43 , the spark conf should not be affected?




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-714627732






----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA removed a comment on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-714865098


   **[Test build #130184 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/130184/testReport)** for PR 30045 at commit [`d194796`](https://github.com/apache/spark/commit/d1947961a366cd76086b9996c4d9687b7c63f3f7).


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-739731557


   I think you are right about reality. But it seems safer to handle the per-session initial configs as it's a property of the `SparkSession`. It's kind of a potential bug and we'd better fix it earlier. @yaooqinn what do you think?


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-708947112






----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a change in pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #30045:
URL: https://github.com/apache/spark/pull/30045#discussion_r506298572



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/command/SetCommand.scala
##########
@@ -172,7 +172,7 @@ object SetCommand {
 case class ResetCommand(config: Option[String]) extends RunnableCommand with IgnoreCachedData {
 
   override def run(sparkSession: SparkSession): Seq[Row] = {
-    val defaults = sparkSession.sparkContext.conf
+    val defaults = sparkSession.sharedState.conf

Review comment:
       ah so this only adds the warehouse dir config compared to the `sparkContext.conf`?




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA removed a comment on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-708998287


   **[Test build #129825 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/129825/testReport)** for PR 30045 at commit [`ccbf0ae`](https://github.com/apache/spark/commit/ccbf0aefd7070e13fe998b35a1ae48796a0c8f38).


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-709138455


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/34431/
   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan closed pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
cloud-fan closed pull request #30045:
URL: https://github.com/apache/spark/pull/30045


   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-709985348


   Test FAILed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/129883/
   Test FAILed.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-708990914


   **[Test build #129815 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/129815/testReport)** for PR 30045 at commit [`a52c86a`](https://github.com/apache/spark/commit/a52c86afa3636f819989782c48346a533ca7a079).
    * This patch **fails Spark unit tests**.
    * This patch merges cleanly.
    * This patch adds no public classes.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-708946584


   **[Test build #129792 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/129792/testReport)** for PR 30045 at commit [`f253fad`](https://github.com/apache/spark/commit/f253fad00c14376e950804849481fa6252cd8154).
    * This patch **fails due to an unknown error code, -9**.
    * This patch merges cleanly.
    * This patch adds no public classes.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-708991212


   Test FAILed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/129815/
   Test FAILed.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-709878764


   **[Test build #129883 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/129883/testReport)** for PR 30045 at commit [`6848b2f`](https://github.com/apache/spark/commit/6848b2fed2be7137f4133bb7ec1790b9aad1ba29).


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA removed a comment on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-714370497


   **[Test build #130150 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/130150/testReport)** for PR 30045 at commit [`0cbb4bc`](https://github.com/apache/spark/commit/0cbb4bc82360f0bc75b2186ea9c6df00b52bb84c).


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-714614408


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/34773/
   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] yaooqinn edited a comment on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
yaooqinn edited a comment on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-739534847


   > I have a question about the semantics. We currently reset to the initial state of the first session. You can have many different sessions (e.g. in thrift server) with different initial settings, IMO it would be more sane to reset to the initial state of the current session. WDYT?
   
   I did some research: 
   
   w/o calling `clearDefaultSession` and `clearActiveSession`(there was a PR to make these 2 internal but reverted for some reasons), the existing APIs for creating new `SparkSession` cannot lead users to such a situation.
   
   Let's assume the initial configs we talk about here is those going with the instantiating process of a SparkSession instance, not those being the first-time set
   1. w/ the SparkSession.newSession() API, there are **no** parameters provided to set  initial configs
   2. w the SparkSession.Builder.getOrCreate, we are just referencing the original one only but **w/o creating a new SparkSession instance**.
   
   So do we have a way to actually create a new session with initial configs when there is an existing active one? The answer is NO.
   
   This situation only happens when these 2 APIs called, but the current approach actually meets our goal here. We do keep the session configs per session in such a use case. 
   
   The actual problem here that revealed in the following case is that the GLOBAL SharedState is not being shared after those clear-like APIs being called
   
   ```scala
   scala> org.apache.spark.sql.SparkSession.clearDefaultSession()
   
   scala> org.apache.spark.sql.SparkSession.clearActiveSession()
   
   scala> val nes = org.apache.spark.sql.SparkSession.builder.config("spark.sql.warehouse.dir", "w2").config("spark.sql.globalTempDatabase", "m2").config("spark.sql.custom", "xyz").getOrCreate
   20/12/07 00:59:35 WARN SparkContext: Using an existing SparkContext; some configuration may not take effect.
   nes: org.apache.spark.sql.SparkSession = org.apache.spark.sql.SparkSession@175f1ff5
   
   scala> nes.conf.get("spark.sql.warehouse.dir")
   20/12/07 01:00:06 WARN SharedState: Not allowing to set spark.sql.warehouse.dir or hive.metastore.warehouse.dir in SparkSession's options, it should be set statically for cross-session usages
   res2: String = w2
   
   scala> nes.conf.get("spark.sql.globalTempDatabase")
   res3: String = m2
   
   scala> nes.conf.get("spark.sql.custom")
   res4: String = xyz
   
   scala> nes.sql("reset")
   res5: org.apache.spark.sql.DataFrame = []
   
   scala> nes.conf.get("spark.sql.globalTempDatabase")
   res6: String = m2
   
   scala> nes.conf.get("spark.sql.custom")
   res7: String = xyz
   ```
   
   cc @gatorsmile @cloud-fan 


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-714721406


   Test FAILed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/130166/
   Test FAILed.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-709900599


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/34488/
   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-709985337


   Merged build finished. Test FAILed.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-708949999


   **[Test build #129815 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/129815/testReport)** for PR 30045 at commit [`a52c86a`](https://github.com/apache/spark/commit/a52c86afa3636f819989782c48346a533ca7a079).


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-710181567


   Kubernetes integration test status success
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/34506/
   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a change in pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #30045:
URL: https://github.com/apache/spark/pull/30045#discussion_r506303081



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/internal/SharedState.scala
##########
@@ -55,10 +55,11 @@ private[sql] class SharedState(
 
   SharedState.setFsUrlStreamHandlerFactory(sparkContext.conf, sparkContext.hadoopConfiguration)
 
-  private val (conf, hadoopConf) = {
+  private[sql] val (conf, hadoopConf) = {
     // Load hive-site.xml into hadoopConf and determine the warehouse path which will be set into
     // both spark conf and hadoop conf avoiding be affected by any SparkSession level options
-    SharedState.loadHiveConfFile(sparkContext.conf, sparkContext.hadoopConfiguration)
+    SharedState.loadHiveConfFile(
+      sparkContext.conf, sparkContext.hadoopConfiguration, initialConfigs)

Review comment:
       how is it related to RESET?




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] yaooqinn commented on a change in pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
yaooqinn commented on a change in pull request #30045:
URL: https://github.com/apache/spark/pull/30045#discussion_r506352466



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/internal/SharedState.scala
##########
@@ -55,10 +55,11 @@ private[sql] class SharedState(
 
   SharedState.setFsUrlStreamHandlerFactory(sparkContext.conf, sparkContext.hadoopConfiguration)
 
-  private val (conf, hadoopConf) = {
+  private[sql] val (conf, hadoopConf) = {
     // Load hive-site.xml into hadoopConf and determine the warehouse path which will be set into
     // both spark conf and hadoop conf avoiding be affected by any SparkSession level options
-    SharedState.loadHiveConfFile(sparkContext.conf, sparkContext.hadoopConfiguration)
+    SharedState.loadHiveConfFile(
+      sparkContext.conf, sparkContext.hadoopConfiguration, initialConfigs)

Review comment:
       This is kind of a hidden bug here, If we create a SparkSession like this: 
   ```scala
   SparkSession.builder.sparkContext(sc).config("spark.sql.warehouse.dir", "abc").getOrCreate()
   ```
   The `"spark.sql.warehouse.dir", "abc"` is used by the SessionCatalog correctly, but we do not set it in the cloned conf in SharedState. It causes the default database may use a wrong path here https://github.com/apache/spark/blob/f253fad00c14376e950804849481fa6252cd8154/sql/core/src/main/scala/org/apache/spark/sql/internal/SharedState.scala#L135
   And If we want to use it for RESET, we also need this config to be kept here.




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-708884194


   **[Test build #129792 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/129792/testReport)** for PR 30045 at commit [`f253fad`](https://github.com/apache/spark/commit/f253fad00c14376e950804849481fa6252cd8154).


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-714442317


   **[Test build #130150 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/130150/testReport)** for PR 30045 at commit [`0cbb4bc`](https://github.com/apache/spark/commit/0cbb4bc82360f0bc75b2186ea9c6df00b52bb84c).
    * This patch **fails Spark unit tests**.
    * This patch merges cleanly.
    * This patch adds no public classes.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-709909596






----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] HyukjinKwon commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-711137480


   From a cursory look, I think this is correct. But probably it's best to have @hvanhovell's look.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-714584120


   **[Test build #130166 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/130166/testReport)** for PR 30045 at commit [`d194796`](https://github.com/apache/spark/commit/d1947961a366cd76086b9996c4d9687b7c63f3f7).


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-710495658






----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-714885452






----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA removed a comment on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-708884194


   **[Test build #129792 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/129792/testReport)** for PR 30045 at commit [`f253fad`](https://github.com/apache/spark/commit/f253fad00c14376e950804849481fa6252cd8154).


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-714428464






----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-709179250


   Kubernetes integration test status success
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/34431/
   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-709379575


   **[Test build #129825 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/129825/testReport)** for PR 30045 at commit [`ccbf0ae`](https://github.com/apache/spark/commit/ccbf0aefd7070e13fe998b35a1ae48796a0c8f38).
    * This patch passes all tests.
    * This patch merges cleanly.
    * This patch adds no public classes.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-708993827


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/34420/
   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA removed a comment on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-708949999


   **[Test build #129815 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/129815/testReport)** for PR 30045 at commit [`a52c86a`](https://github.com/apache/spark/commit/a52c86afa3636f819989782c48346a533ca7a079).


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] yaooqinn commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
yaooqinn commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-739534847


   > I have a question about the semantics. We currently reset to the initial state of the first session. You can have many different sessions (e.g. in thrift server) with different initial settings, IMO it would be more sane to reset to the initial state of the current session. WDYT?
   
   I did some research: 
   
   w/o calling `clearDefaultSession` and `clearActiveSession`(there was a PR to make these 2 internal but reverted for some reasons), the existing APIs for creating new `SparkSession` cannot lead users to such a situation.
   
   Let's assume the initial configs we talk about here is those going with the instantiating process of a SparkSession instance, not those being the first-time set
   1. w/ the SparkSession.newSession() API, there are **no** parameters provided to set  initial configs
   2. w the SparkSession.Builder.getOrCreate, we are just referencing the original one only but **w/o creating a new SparkSession instance**.
   
   So do we have a way to actually create a new session with initial configs when there is an existing active one? The answer is NO.
   
   This situation only happens when these 2 APIs called, but the current approach actually meets our goal here. We do keep the session configs per session in such a use case. 
   
   The actual problem here that revealed in the following case is that the GLOBAL SharedState is not being shared after those clear-like APIs being called
   
   {code:java}
   scala> org.apache.spark.sql.SparkSession.clearDefaultSession()
   
   scala> org.apache.spark.sql.SparkSession.clearActiveSession()
   
   scala> val nes = org.apache.spark.sql.SparkSession.builder.config("spark.sql.warehouse.dir", "w2").config("spark.sql.globalTempDatabase", "m2").config("spark.sql.custom", "xyz").getOrCreate
   20/12/07 00:59:35 WARN SparkContext: Using an existing SparkContext; some configuration may not take effect.
   nes: org.apache.spark.sql.SparkSession = org.apache.spark.sql.SparkSession@175f1ff5
   
   scala> nes.conf.get("spark.sql.warehouse.dir")
   20/12/07 01:00:06 WARN SharedState: Not allowing to set spark.sql.warehouse.dir or hive.metastore.warehouse.dir in SparkSession's options, it should be set statically for cross-session usages
   res2: String = w2
   
   scala> nes.conf.get("spark.sql.globalTempDatabase")
   res3: String = m2
   
   scala> nes.conf.get("spark.sql.custom")
   res4: String = xyz
   
   scala> nes.sql("reset")
   res5: org.apache.spark.sql.DataFrame = []
   
   scala> nes.conf.get("spark.sql.globalTempDatabase")
   res6: String = m2
   
   scala> nes.conf.get("spark.sql.custom")
   res7: String = xyz
   {code}
   
   cc @gatorsmile @cloud-fan 


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-709381363






----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-714370497


   **[Test build #130150 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/130150/testReport)** for PR 30045 at commit [`0cbb4bc`](https://github.com/apache/spark/commit/0cbb4bc82360f0bc75b2186ea9c6df00b52bb84c).


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a change in pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #30045:
URL: https://github.com/apache/spark/pull/30045#discussion_r510012120



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/internal/SharedState.scala
##########
@@ -254,9 +258,10 @@ object SharedState extends Logging {
       // the value of spark.sql.warehouse.dir.
       // When neither spark.sql.warehouse.dir nor hive.metastore.warehouse.dir is set
       // we will set hive.metastore.warehouse.dir to the default value of spark.sql.warehouse.dir.
-      val sparkWarehouseDir = sparkConf.get(WAREHOUSE_PATH)
+      val sparkWarehouseDir = sparkWarehouse.getOrElse(sparkConf.get(WAREHOUSE_PATH))

Review comment:
       `sparkWarehouse` already has `.orElse(sparkConf.getOption(WAREHOUSE_PATH.key))`. Do you mean `sparkWarehouse.getOrElse(WAREHOUSE_PATH.defaultValueString)`?




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-714721394






----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-708998287


   **[Test build #129825 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/129825/testReport)** for PR 30045 at commit [`ccbf0ae`](https://github.com/apache/spark/commit/ccbf0aefd7070e13fe998b35a1ae48796a0c8f38).


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-710153706


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/34506/
   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-714416811


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/34757/
   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-714442719


   Merged build finished. Test FAILed.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA removed a comment on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-710114143


   **[Test build #129900 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/129900/testReport)** for PR 30045 at commit [`91c2e91`](https://github.com/apache/spark/commit/91c2e91b3c6133951a44214911ede8e51ffc07fa).


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-710492296


   **[Test build #129900 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/129900/testReport)** for PR 30045 at commit [`91c2e91`](https://github.com/apache/spark/commit/91c2e91b3c6133951a44214911ede8e51ffc07fa).
    * This patch passes all tests.
    * This patch merges cleanly.
    * This patch adds no public classes.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] yaooqinn edited a comment on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
yaooqinn edited a comment on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-739534847


   > I have a question about the semantics. We currently reset to the initial state of the first session. You can have many different sessions (e.g. in thrift server) with different initial settings, IMO it would be more sane to reset to the initial state of the current session. WDYT?
   
   I did some research: 
   
   w/o calling `clearDefaultSession` and `clearActiveSession`(there was a PR to make these 2 internal but reverted for some reasons), the existing APIs for creating new `SparkSession` cannot lead users to such a situation.
   
   Let's assume the initial configs we talk about here is those going with the instantiating process of a SparkSession instance, not those being the first-time set
   1. w/ the SparkSession.newSession() API, there are **no** parameters provided to set  initial configs
   2. w the SparkSession.Builder.getOrCreate, we are just referencing the original one only but **w/o creating a new SparkSession instance**.
   
   So do we have a way to actually create a new session with initial configs when there is an existing active one? The answer is NO.
   
   This situation only happens when these 2 APIs called, but the current approach actually meets our goal here. We do keep the session configs per session in such a use case. 
   
   The actual problem here that revealed in the following case is that the GLOBAL SharedState is not being shared after those clear-like APIs being called
   
   ```shell
   bin/spark-shell \
     --conf spark.sql.warehouse.dir=./warehouse \
     --conf spark.sql.globalTempDatabase=mytemp \
     --conf spark.sql.custom=abc
   ```
   ```scala
   scala> org.apache.spark.sql.SparkSession.clearDefaultSession()
   
   scala> org.apache.spark.sql.SparkSession.clearActiveSession()
   
   scala> val nes = org.apache.spark.sql.SparkSession.builder.config("spark.sql.warehouse.dir", "w2").config("spark.sql.globalTempDatabase", "m2").config("spark.sql.custom", "xyz").getOrCreate
   20/12/07 00:59:35 WARN SparkContext: Using an existing SparkContext; some configuration may not take effect.
   nes: org.apache.spark.sql.SparkSession = org.apache.spark.sql.SparkSession@175f1ff5
   
   scala> nes.conf.get("spark.sql.warehouse.dir")
   20/12/07 01:00:06 WARN SharedState: Not allowing to set spark.sql.warehouse.dir or hive.metastore.warehouse.dir in SparkSession's options, it should be set statically for cross-session usages
   res2: String = w2
   
   scala> nes.conf.get("spark.sql.globalTempDatabase")
   res3: String = m2
   
   scala> nes.conf.get("spark.sql.custom")
   res4: String = xyz
   
   scala> nes.sql("reset")
   res5: org.apache.spark.sql.DataFrame = []
   
   scala> nes.conf.get("spark.sql.globalTempDatabase")
   res6: String = m2
   
   scala> nes.conf.get("spark.sql.custom")
   res7: String = xyz
   ```
   
   cc @gatorsmile @cloud-fan 


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-708912488


   Kubernetes integration test status success
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/34400/
   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-714977808






----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] yaooqinn commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
yaooqinn commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-714864181


   retest this please


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-708912505






----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-714442729


   Test FAILed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/130150/
   Test FAILed.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] yaooqinn commented on a change in pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
yaooqinn commented on a change in pull request #30045:
URL: https://github.com/apache/spark/pull/30045#discussion_r510260724



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/internal/SharedState.scala
##########
@@ -254,9 +258,10 @@ object SharedState extends Logging {
       // the value of spark.sql.warehouse.dir.
       // When neither spark.sql.warehouse.dir nor hive.metastore.warehouse.dir is set
       // we will set hive.metastore.warehouse.dir to the default value of spark.sql.warehouse.dir.
-      val sparkWarehouseDir = sparkConf.get(WAREHOUSE_PATH)
+      val sparkWarehouseDir = sparkWarehouse.getOrElse(sparkConf.get(WAREHOUSE_PATH))

Review comment:
       SGTM




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] yaooqinn commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
yaooqinn commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-739766943


   I have created https://github.com/apache/spark/pull/30642 to fix this


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] yaooqinn commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
yaooqinn commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-739694075


   > @yaooqinn active session is a thread local. What if we create a new session in another thread?
   
   In this case, then  we have to clean the default session ahead


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-710181598






----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-710181598






----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-710495658






----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] HyukjinKwon commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-726804817


   ^^ makes sense to me.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-709381363






----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-714977808






----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a change in pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #30045:
URL: https://github.com/apache/spark/pull/30045#discussion_r510013200



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/SparkSessionBuilderSuite.scala
##########
@@ -300,4 +300,58 @@ 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()
+
+    // When creating the first session like above, we will update the shared spark conf to the
+    // newly specified values
+    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,
+      "The warehouse dir in session conf and shared state conf should be consistent")

Review comment:
       `session conf` -> `spark conf`




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-709909565


   Kubernetes integration test status success
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/34488/
   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-709015932






----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-714720659


   **[Test build #130166 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/130166/testReport)** for PR 30045 at commit [`d194796`](https://github.com/apache/spark/commit/d1947961a366cd76086b9996c4d9687b7c63f3f7).
    * This patch **fails Spark unit tests**.
    * This patch merges cleanly.
    * This patch adds no public classes.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-708947112






----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] yaooqinn commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
yaooqinn commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-727845596


   make sense to me too, I will raise a followup later.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-708991196


   Merged build finished. Test FAILed.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-708912505






----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] hvanhovell commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
hvanhovell commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-726766479


   @cloud-fan @yaooqinn I have a question about the semantics. We currently reset to the initial state of the first session. You can have many different sessions (e.g. in thrift server) with different initial settings, IMO it would be more sane to reset to the initial state of the current session. WDYT?


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #30045: [SPARK-32991][SQL] Use conf in shared state as the original configuraion for RESET

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30045:
URL: https://github.com/apache/spark/pull/30045#issuecomment-714865098


   **[Test build #130184 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/130184/testReport)** for PR 30045 at commit [`d194796`](https://github.com/apache/spark/commit/d1947961a366cd76086b9996c4d9687b7c63f3f7).


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org