Skip to content

Commit fb95f9c

Browse files
author
Prashant Singh
committed
V2SessionCatalog should not throw NoSuchDatabaseException in loadNamespaceMetadata
1 parent b588d07 commit fb95f9c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/V2SessionCatalog.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ class V2SessionCatalog(catalog: SessionCatalog)
244244

245245
override def loadNamespaceMetadata(namespace: Array[String]): util.Map[String, String] = {
246246
namespace match {
247-
case Array(db) =>
247+
case Array(db) if catalog.databaseExists(db) =>
248248
catalog.getDatabaseMetadata(db).toMetadata
249249

250250
case _ =>

sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/v2/V2SessionCatalogSuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ class V2SessionCatalogNamespaceSuite extends V2SessionCatalogBaseSuite {
850850
test("loadNamespaceMetadata: fail missing namespace") {
851851
val catalog = newCatalog()
852852

853-
val exc = intercept[NoSuchDatabaseException] {
853+
val exc = intercept[NoSuchNamespaceException] {
854854
catalog.loadNamespaceMetadata(testNs)
855855
}
856856

0 commit comments

Comments
 (0)