Github user jiangxb1987 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16674#discussion_r100689894
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
 ---
    @@ -617,13 +617,17 @@ class Analyzer(
         private def lookupTableFromCatalog(
             u: UnresolvedRelation,
             defaultDatabase: Option[String] = None): LogicalPlan = {
    +      val tableIdentWithDb = u.tableIdentifier.copy(
    +        database = u.tableIdentifier.database.orElse(defaultDatabase))
    --- End diff --
    
    For a temp view, we should not set the database of the tableIdentifier. 
Perhaps we can change the case statement to:
    ```
            case _: NoSuchDatabaseException if db.isDefined =>
              u.failAnalysis(s"Table or view not found: 
${tableIdentWithDb.unquotedString}, the " +
                s"database ${db.get} doesn't exsits.")
    ```


---
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]

Reply via email to