Skip to content

Commit

Permalink
typo & fix ut
Browse files Browse the repository at this point in the history
  • Loading branch information
yaooqinn committed Feb 1, 2019
1 parent 62d2aa3 commit 8004c19
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class SparkSession private(
@Unstable
@transient
lazy val sharedState: SharedState = {
existingSharedState.getOrElse(new SharedState(sparkContext, initialSessionOptions.toMap))
existingSharedState.getOrElse(new SharedState(sparkContext, initialSessionOptions))
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package org.apache.spark.sql.internal
import java.net.URL
import java.util.Locale

import scala.collection.Map
import scala.reflect.ClassTag
import scala.util.control.NonFatal

Expand All @@ -36,6 +37,7 @@ import org.apache.spark.sql.internal.StaticSQLConf._
import org.apache.spark.status.ElementTrackingStore
import org.apache.spark.util.{MutableURLClassLoader, Utils}


/**
* A class that holds all state shared across sessions in a given [[SQLContext]].
*/
Expand All @@ -48,11 +50,10 @@ private[sql] class SharedState(val sparkContext: SparkContext, initConfig: Map[S
// `SharedState`, all `SparkSession` level configurations have higher priority to generate a
// `SharedState` instance. This will be done only once then shared across `SparkSession`s
initConfig.foreach { case (k, v) =>
logDebug(s"Applying initiate SparkSession options to SparkConf/HadoopConf: $k -> $v")
logDebug(s"Applying initial SparkSession options to SparkConf/HadoopConf: $k -> $v")
conf.set(k, v)
hadoopConf.set(k, v)
}
logInfo("Applied all initiate SparkSession options to the brand new SharedState")

// Load hive-site.xml into hadoopConf and determine the warehouse path we want to use, based on
// the config from both hive and Spark SQL. Finally set the warehouse config value to sparkConf.
Expand Down Expand Up @@ -87,8 +88,10 @@ private[sql] class SharedState(val sparkContext: SparkContext, initConfig: Map[S
sparkWarehouseDir
}
}
sparkContext.conf.set(WAREHOUSE_PATH.key, warehousePath)
logInfo(s"Warehouse path is '$warehousePath'.")


/**
* Class for caching query results reused in future executions.
*/
Expand Down Expand Up @@ -118,7 +121,7 @@ private[sql] class SharedState(val sparkContext: SparkContext, initConfig: Map[S
SessionCatalog.DEFAULT_DATABASE,
"default database",
CatalogUtils.stringToURI(warehousePath),
Map())
Map.empty[String, String])
// Create default database if it doesn't exist
if (!externalCatalog.databaseExists(SessionCatalog.DEFAULT_DATABASE)) {
// There may be another Spark application creating default database at the same time, here we
Expand Down

0 comments on commit 8004c19

Please sign in to comment.