GitHub user liancheng opened a pull request:

    https://github.com/apache/spark/pull/11421

    Supports Scala object as outer scope

    ## What changes were proposed in this pull request?
    
    When an inner class is defined in a Scala object, we can't find it's outer 
scope even if we add the outer object to `OuterScopes`. This is because the 
added class name is the one with `$` suffix (class name of the object), while 
Java `getDeclaringClass` looks for the one without `$` suffix.
    
    This PR fixes this issue simply by stripping the `$` suffix from the class 
name when adding an outer class/object to `OuterScopes`.
    
    ## How was this patch tested?
    
    A test case is added to `DatasetSuite`. It creates a Dataset of an inner 
class declared in an outer object. The test should be able to find the encoder 
successfully.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/liancheng/spark 
spark-13540-object-as-outer-scope

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/11421.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #11421
    
----
commit dc225af74c2efcf63bdea6f0208e95c0e1c4032b
Author: Cheng Lian <[email protected]>
Date:   2016-02-28T16:17:51Z

    Supports Scala object as outer scope

----


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