Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-15166][SQL] Move some hive-specific code from SparkSession #12941

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 0 additions & 13 deletions sql/core/src/main/scala/org/apache/spark/sql/SparkSession.scala
Expand Up @@ -73,19 +73,6 @@ class SparkSession private(
| Session-related state |
* ----------------------- */

{
val defaultWarehousePath =
SQLConf.WAREHOUSE_PATH
.defaultValueString
.replace("${system:user.dir}", System.getProperty("user.dir"))
val warehousePath = sparkContext.conf.get(
SQLConf.WAREHOUSE_PATH.key,
defaultWarehousePath)
sparkContext.conf.set(SQLConf.WAREHOUSE_PATH.key, warehousePath)
sparkContext.conf.set("hive.metastore.warehouse.dir", warehousePath)
logInfo(s"Setting warehouse location to $warehousePath")
}

/**
* State shared across sessions, including the [[SparkContext]], cached data, listener,
* and a catalog that interacts with external systems.
Expand Down
Expand Up @@ -17,8 +17,6 @@

package org.apache.spark.sql.hive

import org.apache.hadoop.hive.conf.HiveConf.ConfVars

import org.apache.spark.sql._
import org.apache.spark.sql.catalyst.analysis.Analyzer
import org.apache.spark.sql.execution.SparkPlanner
Expand Down
Expand Up @@ -18,18 +18,27 @@
package org.apache.spark.sql.hive

import org.apache.spark.SparkContext
import org.apache.spark.sql.hive.client.{HiveClient, HiveClientImpl}
import org.apache.spark.sql.internal.SharedState
import org.apache.spark.internal.Logging
import org.apache.spark.sql.hive.client.HiveClient
import org.apache.spark.sql.internal.{SharedState, SQLConf}


/**
* A class that holds all state shared across sessions in a given
* [[org.apache.spark.sql.SparkSession]] backed by Hive.
*/
private[hive] class HiveSharedState(override val sparkContext: SparkContext)
extends SharedState(sparkContext) {
extends SharedState(sparkContext) with Logging {

// TODO: just share the IsolatedClientLoader instead of the client instances themselves
// TODO: just share the IsolatedClientLoader instead of the client instance itself

{
// Set the Hive metastore warehouse path to the one we use
val tempConf = new SQLConf
sparkContext.conf.getAll.foreach { case (k, v) => tempConf.setConfString(k, v) }
sparkContext.conf.set("hive.metastore.warehouse.dir", tempConf.warehousePath)
logInfo(s"Setting Hive metastore warehouse path to '${tempConf.warehousePath}'")
}

/**
* A Hive client used to interact with the metastore.
Expand Down