Github user zsxwing commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16826#discussion_r100193350
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/internal/SessionState.scala ---
    @@ -38,16 +38,31 @@ import 
org.apache.spark.sql.util.ExecutionListenerManager
     
     /**
      * A class that holds all session-specific state in a given 
[[SparkSession]].
    + * If an `existingSessionState` is supplied, then its members will be 
copied over.
      */
    -private[sql] class SessionState(sparkSession: SparkSession) {
    +private[sql] class SessionState(
    +    sparkSession: SparkSession,
    +    existingSessionState: Option[SessionState]) {
    +
    +  private[sql] def this(sparkSession: SparkSession) = {
    +    this(sparkSession, None)
    +  }
     
       // Note: These are all lazy vals because they depend on each other (e.g. 
conf) and we
       // want subclasses to override some of the fields. Otherwise, we would 
get a lot of NPEs.
     
       /**
        * SQL-specific key-value configurations.
        */
    -  lazy val conf: SQLConf = new SQLConf
    +  lazy val conf: SQLConf = {
    +    val result = new SQLConf
    +    if (existingSessionState.nonEmpty) {
    --- End diff --
    
    nit:
    ```scala
        existingSessionState.foreach(_.conf.getAllConfs.foreach {
          case (k, v) => if (v ne null) result.setConfString(k, v)
        })
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to