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

    https://github.com/apache/spark/pull/13563#discussion_r66873430
  
    --- Diff: core/src/main/scala/org/apache/spark/rdd/RDD.scala ---
    @@ -734,12 +737,14 @@ abstract class RDD[T: ClassTag](
           printPipeContext: (String => Unit) => Unit = null,
           printRDDElement: (T, String => Unit) => Unit = null,
           separateWorkingDir: Boolean = false,
    -      bufferSize: Int = 8192): RDD[String] = withScope {
    +      bufferSize: Int = 8192,
    +      encoding: Charset = StandardCharsets.UTF_8): RDD[String] = withScope 
{
    --- End diff --
    
    @zsxwing 
    
    >> Use Codec for Scala API.
    
    `Codec` is scala specific. I intentionally did not use that because I 
wanted Java and Scala APIs to accept the same param types.
    
    Anyways, based on the test case failures, none of Charset or Codec would 
work because they need to be serializable (I see 
`org.apache.spark.SparkException: Task not serializable` while running this 
change). I will use `String` instead. Is that fine ?
    
    >> I suggest using Codec.defaultCharsetCodec as the default value
    
    Thanks for catching that. Its unfortunate to not have UTF8 as the default 
... but backward compatibility is far more important.
    
    ```
    Caused by: java.io.NotSerializableException: sun.nio.cs.UTF_8
    Serialization stack:
        - object not serializable (class: sun.nio.cs.UTF_8, value: UTF-8)
        - field (class: org.apache.spark.rdd.PipedRDD, name: 
org$apache$spark$rdd$PipedRDD$$encoding, type: class java.nio.charset.Charset)
        - object (class org.apache.spark.rdd.PipedRDD, PipedRDD[1] at pipe at 
<console>:29)
        - field (class: org.apache.spark.rdd.RDD$$anonfun$collect$1, name: 
$outer, type: class org.apache.spark.rdd.RDD)
        - object (class org.apache.spark.rdd.RDD$$anonfun$collect$1, 
<function0>)
        - field (class: 
org.apache.spark.rdd.RDD$$anonfun$collect$1$$anonfun$12, name: $outer, type: 
class org.apache.spark.rdd.RDD$$anonfun$collect$1)
        - object (class 
org.apache.spark.rdd.RDD$$anonfun$collect$1$$anonfun$12, <function1>)
        at 
org.apache.spark.serializer.SerializationDebugger$.improveException(SerializationDebugger.scala:40)
        at 
org.apache.spark.serializer.JavaSerializationStream.writeObject(JavaSerializer.scala:47)
        at 
org.apache.spark.serializer.JavaSerializerInstance.serialize(JavaSerializer.scala:101)
        at 
org.apache.spark.util.ClosureCleaner$.ensureSerializable(ClosureCleaner.scala:301)
        ... 56 more
    ```


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