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

    https://github.com/apache/spark/pull/5776#discussion_r29864118
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
 ---
    @@ -169,36 +203,20 @@ class Analyzer(
        * Replaces [[UnresolvedRelation]]s with concrete relations from the 
catalog.
        */
       object ResolveRelations extends Rule[LogicalPlan] {
    -    def getTable(u: UnresolvedRelation, cteRelations: Map[String, 
LogicalPlan]): LogicalPlan = {
    +    def getTable(u: UnresolvedRelation): LogicalPlan = {
           try {
    -        // In hive, if there is same table name in database and CTE 
definition,
    -        // hive will use the table in database, not the CTE one.
    -        // Taking into account the reasonableness and the implementation 
complexity,
    -        // here use the CTE definition first, check table name only and 
ignore database name
    -        cteRelations.get(u.tableIdentifier.last)
    -          .map(relation => u.alias.map(Subquery(_, 
relation)).getOrElse(relation))
    -          .getOrElse(catalog.lookupRelation(u.tableIdentifier, u.alias))
    +        catalog.lookupRelation(u.tableIdentifier, u.alias)
           } catch {
             case _: NoSuchTableException =>
               u.failAnalysis(s"no such table ${u.tableName}")
           }
         }
     
    -    def apply(plan: LogicalPlan): LogicalPlan = {
    -      val (realPlan, cteRelations) = plan match {
    -        // TODO allow subquery to define CTE
    -        // Add cte table to a temp relation map,drop `with` plan and keep 
its child
    --- End diff --
    
    Should we keep the TODO at here?


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