GitHub user AbhiMadav opened a pull request:

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

    [SPARK-17922] [SQL] ClassCastException java.lang.ClassCastException: 
org.apache.spark.sql.catalyst.expressions.GeneratedClass$GeneratedIterator 
cannot be cast to org.apache.spark.sql.catalyst.expressions.UnsafeProjection

    ## What changes were proposed in this pull request?
    
    Janino compiler internally creates a byteclassloader 
(http://grepcode.com/file/repo1.maven.org/maven2/org.codehaus.janino/janino/2.5.15/org/codehaus/janino/ByteArrayClassLoader.java#ByteArrayClassLoader)
 to load the compiled generated class. But this class loader doesnot override 
load class to load the class from byte array for the generated class. Instead 
the call first goes to parent class loader and if somehow the classloader finds 
the old generatedClass( all the generated class names are same) it will 
incorrectly load the old generated class. This class loader will be used to 
intercept delegation to parent if the class has to be loaded by the current 
byte class loader. This will be set as the parent class loader for janino 
compiler in CodeGenerator.doCompile.
    
    Special classloader to skip delegating to parent class loader when the 
class name is same as the generated class name. Because that class should be 
loaded by the current class loader 
    
    ## How was this patch tested?
    
    manual tests

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

    $ git pull https://github.com/AbhiMadav/spark master

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

    https://github.com/apache/spark/pull/15591.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 #15591
    
----
commit fa5004df3a6a41e8b6835532714ff7fa69933983
Author: Abhishek Madav <abhima...@gmail.com>
Date:   2016-10-21T01:00:06Z

    SPARK-17922
    
    ClassCastException java.lang.ClassCastException:
    org.apache.spark.sql.catalyst.expressions.GeneratedClass$GeneratedIterator
    cannot be cast to
    org.apache.spark.sql.catalyst.expressions.UnsafeProjection

----


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to