Github user dongjoon-hyun commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14114#discussion_r70309114
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala
 ---
    @@ -246,9 +246,27 @@ class SessionCatalog(
       def getTableMetadata(name: TableIdentifier): CatalogTable = {
         val db = 
formatDatabaseName(name.database.getOrElse(getCurrentDatabase))
         val table = formatTableName(name.table)
    -    requireDbExists(db)
    -    requireTableExists(TableIdentifier(table, Some(db)))
    -    externalCatalog.getTable(db, table)
    +    val tid = TableIdentifier(table)
    +    if (name.database.isEmpty && isTemporaryTable(tid)) {
    --- End diff --
    
    Oops. @hvanhovell . I found the original reason.
    The logic of `isTemporaryTable` only lookup `current database`. We should 
support the following. 
    ```
    val m3 = intercept[AnalysisException] {
          catalog.getTableMetadata(TableIdentifier("view1", Some("default")))
        }.getMessage
        assert(m3.contains("Table or view 'view1' not found in database 
'default'"))
    ```


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to