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

    https://github.com/apache/spark/pull/12067#discussion_r58413497
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
 ---
    @@ -1469,7 +1453,45 @@ class Analyzer(
         Project(projectList, Join(left, right, joinType, newCondition))
       }
     
    +  /**
    +   * Finds and adds the outer scope to [[NewInstance]] if the object being 
constructed is an inner
    +   * class.
    +   */
    +  object AddOuterScope extends Rule[LogicalPlan] {
    +    def apply(plan: LogicalPlan): LogicalPlan = plan transform {
    +      case p if !p.childrenResolved => p
     
    +      case p => p transformExpressions {
    +        case n: NewInstance if n.childrenResolved && !n.resolved =>
    +          val outer = OuterScopes.getOuterScope(n.cls)
    +          if (outer == null) {
    +            throw new AnalysisException(
    +              s"Unable to generate an encoder for inner class 
`${n.cls.getName}` without " +
    +                "access to the scope that this class was defined in.\n" +
    +                "Try moving this class out of its parent class.")
    +          }
    +          n.copy(outerPointer = Some(outer))
    +      }
    +    }
    +  }
    +
    +  /**
    +   * Replaces [[UnresolvedDeserializer]] with the deserialization 
expression that has been resolved
    +   * by the given input attributes.
    --- End diff --
    
    This is also a little confusing.  Do you mean "to the given input 
attributes"?


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