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

    https://github.com/apache/spark/pull/1551#discussion_r15535564
  
    --- Diff: core/src/main/scala/org/apache/spark/api/python/PythonRDD.scala 
---
    @@ -344,7 +345,12 @@ private[spark] object PythonRDD extends Logging {
                   throw new SparkException("Unexpected Tuple2 element type " + 
pair._1.getClass)
               }
             case other =>
    -          throw new SparkException("Unexpected element type " + 
first.getClass)
    +          if (other == null) {
    +            dataOut.writeInt(SpecialLengths.NULL)
    +            writeIteratorToStream(iter, dataOut)
    --- End diff --
    
    It looks like we only have to worry about nulls when writing iterators from 
user-defined RDDs of strings.  So, if we see an iterator that begins with null, 
we can assume that the remainder of the iterator contains only nulls or 
strings.  Therefore, I think you can write out the first null followed by
    
    ```
    iter.asInstanceOf[Iterator[String]].foreach { str =>
      writeUTF(str, dataOut)
    }
    ```
    
    to process the remainder of the stream.


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

Reply via email to