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

    https://github.com/apache/spark/pull/21508#discussion_r194273780
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
 ---
    @@ -1568,11 +1568,32 @@ class Analyzer(
           expr.find(_.isInstanceOf[Generator]).isDefined
         }
     
    -    private def hasNestedGenerator(expr: NamedExpression): Boolean = expr 
match {
    -      case UnresolvedAlias(_: Generator, _) => false
    -      case Alias(_: Generator, _) => false
    -      case MultiAlias(_: Generator, _) => false
    -      case other => hasGenerator(other)
    +    private def hasNestedGenerator(expr: NamedExpression): Boolean = {
    +      trimNonTopLevelAliases(expr) match {
    +        case UnresolvedAlias(_: Generator, _) => false
    +        case Alias(_: Generator, _) => false
    +        case MultiAlias(_: Generator, _) => false
    +        case other => hasGenerator(other)
    +      }
    +    }
    +
    +    def trimNonTopLevelAliases(e: Expression): Expression = e match {
    --- End diff --
    
    Instead of duplicating the function here, could we just fixing 
`CleanupAliases.trimNonTopLevelAliases`


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to