Github user yhuai commented on a diff in the pull request: https://github.com/apache/spark/pull/16233#discussion_r94103444 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala --- @@ -510,32 +510,93 @@ class Analyzer( * Replaces [[UnresolvedRelation]]s with concrete relations from the catalog. */ object ResolveRelations extends Rule[LogicalPlan] { - private def lookupTableFromCatalog(u: UnresolvedRelation): LogicalPlan = { + + // If the unresolved relation is running directly on files, we just return the original + // UnresolvedRelation, the plan will get resolved later. Else we look up the table from catalog + // and change the default database name if it is a view. + // We usually look up a table from the default database if the table identifier has an empty + // database part, for a view the default database should be the currentDb when the view was + // created. When the case comes to resolving a nested view, the view may have different default --- End diff -- oh, nvm, even if we have `database.viewname`, dbname and viewname will be inside the table identifier.
--- 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