Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/16674#discussion_r101111632
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
---
@@ -617,13 +617,18 @@ class Analyzer(
private def lookupTableFromCatalog(
u: UnresolvedRelation,
defaultDatabase: Option[String] = None): LogicalPlan = {
+ val db = u.tableIdentifier.database.orElse(defaultDatabase)
+ val tableIdentWithDb = u.tableIdentifier.copy(database = db)
try {
- val tableIdentWithDb = u.tableIdentifier.copy(
- database = u.tableIdentifier.database.orElse(defaultDatabase))
catalog.lookupRelation(tableIdentWithDb, u.alias)
} catch {
case _: NoSuchTableException =>
- u.failAnalysis(s"Table or view not found: ${u.tableName}")
+ u.failAnalysis(s"Table or view not found:
${tableIdentWithDb.unquotedString}")
+ // If the database is defined and that database is not found,
throw an AnalysisException.
+ // Note that if the database is not defined, it is possible we are
looking up a temp view.
+ case _: NoSuchDatabaseException if db.isDefined =>
--- End diff --
let's remove this if, since we can't get the current database in `Analyzer`
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]