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

    https://github.com/apache/spark/pull/12810#discussion_r61667078
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
 ---
    @@ -165,6 +167,33 @@ class Analyzer(
         }
       }
     
    +  object ValidateGenerator extends Rule[LogicalPlan] {
    +    private def hasGenerator(expr: Expression): Boolean = {
    +      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 if hasGenerator(other) => true
    +      case _ => false
    +    }
    +
    +    def apply(plan: LogicalPlan): LogicalPlan = plan resolveOperators {
    +      case Project(projectList, _) if 
projectList.exists(hasNestedGenerator) =>
    +        throw new AnalysisException("Generators are not supported when 
it's nested in expressions.")
    --- End diff --
    
    i think we need to show the generator itself, as "generator" is a very 
spark sql specific term. If users just put an explode, he/she wont' know it's a 
generator.



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