Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16233#discussion_r94749628
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala
 ---
    @@ -570,10 +573,14 @@ class SessionCatalog(
             }.getOrElse(throw new NoSuchTableException(db, table))
           } else if (name.database.isDefined || !tempTables.contains(table)) {
             val metadata = externalCatalog.getTable(db, table)
    -        val view = Option(metadata.tableType).collect {
    -          case CatalogTableType.VIEW => name
    +        if (metadata.tableType == CatalogTableType.VIEW) {
    +          // The relation is a view, so we wrap the relation by:
    +          // 1. Add a [[View]] operator over the relation to keep track of 
the view desc;
    +          // 2. Wrap the logical plan in a [[SubqueryAlias]] which tracks 
the name of the view.
    +          SubqueryAlias(relationAlias, View(metadata), Some(name))
    --- End diff --
    
    If we wanna support it, we should parse the view text here, and set 
`View.child`, so that we don't need to make `View.child` optional.


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