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

    https://github.com/apache/spark/pull/16826#discussion_r103064447
  
    --- Diff: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveSessionState.scala ---
    @@ -146,4 +107,153 @@ private[hive] class HiveSessionState(sparkSession: 
SparkSession)
         conf.getConf(HiveUtils.HIVE_THRIFT_SERVER_ASYNC)
       }
     
    +  /**
    +   * Get an identical copy of the `HiveSessionState`.
    +   * This should ideally reuse the `SessionState.clone` but cannot do so.
    +   * Doing that will throw an exception when trying to clone the catalog.
    +   */
    +  override def clone(newSparkSession: SparkSession): HiveSessionState = {
    +    val sparkContext = newSparkSession.sparkContext
    +    val confCopy = conf.clone()
    +    val functionRegistryCopy = functionRegistry.clone()
    +    val experimentalMethodsCopy = experimentalMethods.clone()
    +    val sqlParser: ParserInterface = new SparkSqlParser(confCopy)
    +    val catalogCopy = catalog.clone(
    +      newSparkSession,
    +      confCopy,
    +      SessionState.newHadoopConf(sparkContext.hadoopConfiguration, 
confCopy),
    +      functionRegistryCopy,
    +      sqlParser)
    +    val queryExecutionCreator = (plan: LogicalPlan) => new 
QueryExecution(newSparkSession, plan)
    +
    +    val hiveClient =
    +      
newSparkSession.sharedState.externalCatalog.asInstanceOf[HiveExternalCatalog].client
    +        .newSession()
    +
    +    SessionState.mergeSparkConf(confCopy, sparkContext.getConf)
    +
    +    new HiveSessionState(
    +      sparkContext,
    +      newSparkSession.sharedState,
    +      confCopy,
    +      experimentalMethodsCopy,
    +      functionRegistryCopy,
    +      catalogCopy,
    +      sqlParser,
    +      hiveClient,
    +      HiveSessionState.createAnalyzer(newSparkSession, catalogCopy, 
confCopy),
    +      new StreamingQueryManager(newSparkSession),
    +      queryExecutionCreator,
    +      HiveSessionState.createPlannerCreator(
    +        newSparkSession,
    +        confCopy,
    +        experimentalMethodsCopy))
    +  }
    +
    +}
    +
    +object HiveSessionState {
    +
    +  def apply(sparkSession: SparkSession): HiveSessionState = {
    +    apply(sparkSession, None)
    +  }
    +
    +  def apply(
    --- End diff --
    
    same comment as `SessionState.apply`


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to