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

    https://github.com/apache/spark/pull/8755#discussion_r39550885
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/basicOperators.scala
 ---
    @@ -68,13 +68,47 @@ case class Generate(
         generator.resolved &&
           childrenResolved &&
           generator.elementTypes.length == generatorOutput.length &&
    -      !generatorOutput.exists(!_.resolved)
    +      generatorOutput.forall(_.resolved)
       }
     
       // we don't want the gOutput to be taken as part of the expressions
       // as that will cause exceptions like unresolved attributes etc.
       override def expressions: Seq[Expression] = generator :: Nil
     
    +  /**
    +   * Runs [[transformUp]] with `rule` on all expressions present in this 
query operator.
    +   * @param rule the rule to be applied to every expression in this 
operator.
    +   *
    +   * Note: This is used by ResolveReferences, we need to override it to 
not resolve
    +   * `generatorOutput`.
    +   */
    +  override def transformExpressionsUp(rule: PartialFunction[Expression, 
Expression]): this.type = {
    +    var changed = false
    +
    +    @inline def transformExpressionUp(e: Expression): Expression = {
    +      val newE = e.transformUp(rule)
    +      if (newE.fastEquals(e)) {
    +        e
    +      } else {
    +        changed = true
    +        newE
    +      }
    +    }
    +
    +    def recursiveTransform(arg: Any): AnyRef = arg match {
    --- End diff --
    
    Duplicating this code is kind of scary to me.  I think I like the other fix 
better.  Though ideally, I think that we would just fix the Analyzer to 
understand that generate is special.


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