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

    https://github.com/apache/spark/pull/18185#discussion_r128443990
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
 ---
    @@ -753,17 +753,26 @@ class AstBuilder(conf: SQLConf) extends 
SqlBaseBaseVisitor[AnyRef] with Logging
        * hooks.
        */
       override def visitAliasedQuery(ctx: AliasedQueryContext): LogicalPlan = 
withOrigin(ctx) {
    -    val alias = if (ctx.strictIdentifier == null) {
    +    val alias = if (ctx.tableAlias.strictIdentifier == null) {
           // For un-aliased subqueries, use a default alias name that is not 
likely to conflict with
           // normal subquery names, so that parent operators can only access 
the columns in subquery by
           // unqualified names. Users can still use this special qualifier to 
access columns if they
           // know it, but that's not recommended.
           "__auto_generated_subquery_name"
         } else {
    -      ctx.strictIdentifier.getText
    +      ctx.tableAlias.strictIdentifier.getText
         }
     
    -    SubqueryAlias(alias, 
plan(ctx.queryNoWith).optionalMap(ctx.sample)(withSample))
    +    val columnNamesOption = if (ctx.tableAlias.identifierList != null) {
    +      Some(visitIdentifierList(ctx.tableAlias.identifierList)).map { names 
=>
    +        names.map(n => UnresolvedAttribute(n :: Nil))
    +      }
    +    } else {
    +      None
    +    }
    +
    +    SubqueryAlias(alias, 
plan(ctx.queryNoWith).optionalMap(ctx.sample)(withSample),
    --- End diff --
    
    The impact of changing `SubqueryAlias` is too big. How about adding a new 
operator node `UnresolvedSubqueryAlias`? In the analyzer, 
`UnresolvedSubqueryAlias` will be replaced by `Project` + `SubqueryAlias` ?


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