Skip to content

Commit ddd4ea0

Browse files
committed
CR
1 parent 7b39d2b commit ddd4ea0

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ trait CheckAnalysis extends PredicateHelper {
141141

142142
// Skip projects and subquery aliases added by the Analyzer and the SQLBuilder.
143143
def cleanQuery(p: LogicalPlan): LogicalPlan = p match {
144-
case SubqueryAlias(_, child, _) => cleanQuery(child)
145-
case Project(_, child) => cleanQuery(child)
144+
case s: SubqueryAlias => cleanQuery(s.child)
145+
case p: Project => cleanQuery(p.child)
146146
case child => child
147147
}
148148

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -411,11 +411,14 @@ class SessionCatalog(
411411
}
412412

413413
/**
414-
* Return a [[LogicalPlan]] that represents the given table.
414+
* Return a [[LogicalPlan]] that represents the given table or view.
415415
*
416-
* If a database is specified in `name`, this will return the table from that database.
417-
* If no database is specified, this will first attempt to return a temporary table with
418-
* the same name, then, if that does not exist, return the table from the current database.
416+
* If a database is specified in `name`, this will return the table/view from that database.
417+
* If no database is specified, this will first attempt to return a temporary table/view with
418+
* the same name, then, if that does not exist, return the table/view from the current database.
419+
*
420+
* If the relation is a view, the relation will be wrapped in a [[SubqueryAlias]] which will
421+
* track the name of the view.
419422
*/
420423
def lookupRelation(name: TableIdentifier, alias: Option[String] = None): LogicalPlan = {
421424
synchronized {

0 commit comments

Comments
 (0)