Skip to content

Commit 96dcc7d

Browse files
committed
fix empty string location of database
1 parent 3f6e061 commit 96dcc7d

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

sql/core/src/main/scala/org/apache/spark/sql/internal/SharedState.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,8 @@ private[sql] class SharedState(val sparkContext: SparkContext) extends Logging {
9090

9191
// Create the default database if it doesn't exist.
9292
{
93-
// default database set to empty string,
94-
// when reload from metastore using warehouse path to replace it
9593
val defaultDbDefinition = CatalogDatabase(
96-
SessionCatalog.DEFAULT_DATABASE, "default database", "", Map())
94+
SessionCatalog.DEFAULT_DATABASE, "default database", warehousePath, Map())
9795
// Initialize default database if it doesn't exist
9896
if (!externalCatalog.databaseExists(SessionCatalog.DEFAULT_DATABASE)) {
9997
// There may be another Spark application creating default database at the same time, here we

sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,12 +313,11 @@ private[hive] class HiveClientImpl(
313313
override def createDatabase(
314314
database: CatalogDatabase,
315315
ignoreIfExists: Boolean): Unit = withHiveState {
316-
// default database's location always use the warehouse path, here set to emtpy string
317316
client.createDatabase(
318317
new HiveDatabase(
319318
database.name,
320319
database.description,
321-
if (database.name == SessionCatalog.DEFAULT_DATABASE) "" else database.locationUri,
320+
database.locationUri,
322321
Option(database.properties).map(_.asJava).orNull),
323322
ignoreIfExists)
324323
}

0 commit comments

Comments
 (0)