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

    https://github.com/apache/spark/pull/19661#discussion_r149016829
  
    --- Diff: 
core/src/main/scala/org/apache/spark/serializer/KryoSerializer.scala ---
    @@ -178,10 +178,31 @@ class KryoSerializer(conf: SparkConf)
         
kryo.register(Utils.classForName("scala.collection.immutable.Map$EmptyMap$"))
         kryo.register(classOf[ArrayBuffer[Any]])
     
    +    // We can't load those class directly in order to avoid unnecessary 
jar dependencies.
    +    // We load them safely, ignore it if the class not found.
    +    
safeClassLoader("org.apache.spark.mllib.linalg.Vector").foreach(kryo.register(_))
    --- End diff --
    
    It is a little hacky, but not crazy. But rather than this, why not just 
write here something like...
    
    ```
    Seq("org.apache...", "...").foreach { className =>
      try {
        kryo.register(Utils.classForName(className))
      } catch {
        case _: ClassNotFoundException => // do nothing
      }
    }
    ```


---

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

Reply via email to