Skip to content

Commit 74ee507

Browse files
zsxwinghvanhovell
authored andcommitted
[SC-5134] Make sure externalCatalog is lazy again
## What changes were proposed in this pull request? I didn't notice the logic conflict in apache@4ac9759 and databricks/runtime@916eb66 This PR just makes `externalCatalog` lazy again. ## How was this patch tested? Jenkins Author: Shixiong Zhu <[email protected]> Closes apache#129 from zsxwing/fix-2.1-build.
1 parent ab0d2c4 commit 74ee507

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,17 @@ private[sql] class SharedState(sparkSession: SparkSession) extends Logging {
9191

9292
// Wrap the external catalog with an hook calling external catalog when a
9393
// catalog hooks object is defined.
94-
sparkSession.extensions.buildCatalogHooks(sparkSession) match {
94+
val hookedCatalog = sparkSession.extensions.buildCatalogHooks(sparkSession) match {
9595
case Some(catalogListener) => new HookCallingExternalCatalog(catalog, catalogListener)
9696
case None => catalog
9797
}
98-
}
9998

100-
// Create the default database if it doesn't exist.
101-
{
99+
// Create the default database if it doesn't exist.
102100
val defaultDbDefinition = CatalogDatabase(
103101
SessionCatalog.DEFAULT_DATABASE, "default database", warehousePath, Map())
104102
// Initialize default database if it doesn't already exist
105-
externalCatalog.createDatabase(defaultDbDefinition, ignoreIfExists = true)
103+
hookedCatalog.createDatabase(defaultDbDefinition, ignoreIfExists = true)
104+
hookedCatalog
106105
}
107106

108107
/**

0 commit comments

Comments
 (0)