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

    https://github.com/apache/spark/pull/21770#discussion_r202563817
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/CodeGenerator.scala
 ---
    @@ -1588,6 +1588,15 @@ object CodeGenerator extends Logging {
     
       def primitiveTypeName(dt: DataType): String = 
primitiveTypeName(javaType(dt))
     
    +  def getClassName(cls: Class[_]): String = {
    +    try {
    +      return Option(cls.getCanonicalName).getOrElse(cls.getName)
    +    } catch {
    +      case err: InternalError =>
    --- End diff --
    
    Please see the commit 
https://github.com/apache/spark/commit/cc88d7fad16e8b5cbf7b6b9bfe412908782b4a45 
and this is the same fix with 
[Utils.getSimpleName](https://github.com/apache/spark/blob/master/core/src/main/scala/org/apache/spark/util/Utils.scala#L2732).
 Yea, I see and I think this is workaround now.
    
    Yea, in some cases, the doc says that `getCanonicalName` could return null;
    ```
        /**
         * Returns the canonical name of the underlying class as
         * defined by the Java Language Specification.  Returns null if
         * the underlying class does not have a canonical name (i.e., if
         * it is a local or anonymous class or an array whose component
         * type does not have a canonical name).
         * @return the canonical name of the underlying class if it exists, and
         * {@code null} otherwise.
         * @since 1.5
         */
        public String getCanonicalName() {
    ```


---

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

Reply via email to