Skip to content

Commit c3d088f

Browse files
authored
Fixed AnalysisException in crawl_tables task by ignoring the database that is not found (#970)
1 parent 609ab7d commit c3d088f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/databricks/labs/ucx/hive_metastore/tables.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import scala.collection.JavaConverters
44
import org.apache.hadoop.fs._
55
import org.yaml.snakeyaml.Yaml
66
import org.apache.spark.sql.catalyst.analysis.NoSuchDatabaseException
7+
import org.apache.hadoop.hive.metastore.api.NoSuchObjectException
8+
import org.apache.spark.sql.AnalysisException
79
import org.apache.spark.sql.catalyst.catalog.{CatalogTable, CatalogTableType}
810
import org.apache.spark.sql.DataFrame
911
import org.apache.spark.sql.functions.{col,lower,upper}
@@ -28,6 +30,9 @@ def metadataForAllTables(databases: Seq[String], queue: ConcurrentLinkedQueue[Ta
2830
case err: NoSuchDatabaseException =>
2931
failures.add(TableError("hive_metastore", databaseName, null, s"ignoring database because of ${err}"))
3032
null
33+
case err: AnalysisException =>
34+
failures.add(TableError("hive_metastore", databaseName, null, s"ignoring object because of ${err}"))
35+
null
3136
}
3237
if (tables == null) {
3338
failures.add(TableError("hive_metastore", databaseName, null, s"listTables returned null"))

0 commit comments

Comments
 (0)