Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-43099

`Class.getCanonicalName` return null for anonymous class on JDK15+, impacting function registry

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.4.0
    • 3.5.0
    • Spark Core
    • None

    Description

      On JDK15+, lambda and method references are implemented using hidden classes (https://openjdk.org/jeps/371) According to the JEP, 

      Class::getCanonicalName returns null, indicating the hidden class has no canonical name. (Note that the Class object for an anonymous class in the Java language has the same behavior.)

      This means https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala#L53 will always be null.

       

      This can be fixed by replacing `getCanonicalName` with `getName`

       

      Attachments

        Activity

          People

            alexjinghn Alex Jing
            alexjinghn Alex Jing
            Gengliang Wang Gengliang Wang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: