Github user srowen commented on the pull request:

    https://github.com/apache/spark/pull/4591#issuecomment-74397355
  
    To recap:
    
    If you parallelize a Seq of Nothing or Null, you end up with an 
ArrayStoreException in the part of the code that collects results from 
partitions. It's just a Java-Scala compatibility thing that has to be worked 
around. I don't think there's a complete solution.
    
    We can solve the case of Seq[Nothing] by special-casing empty Seq, which at 
least handles the "sc.parallelize(Seq())" case. I used EmptyRDD for this since 
it's logic to make an empty RDD in this case. However an EmptyRDD has no 
partitions, while some code relies on it to have 1 or more empty partitions. So 
I made that possible.
    
    Then I found some code will ultimately call compute() on an EmptyRDD if it 
starts to be returned from parallelize(), and that threw an exception. I had it 
return an empty Iterator.
    
    That ends up putting us back where we started. Except that we can make 
sc.parallelize(Seq()).isEmpty() work by writing sc.parallelize(Seq(), 
0).isEmpty() now.
    
    (Along the way I discovered that calling histogram() on an EmptyRDD fails, 
so I touched that up.)
    
    The rest is tests.
    
    Question: since it doesn't seem possible to totally fix the "Seq()" case, 
and the improvement here for this trouble is small, is it worth doing this or 
just accepting this as a known issue / corner case?
    
    I could trim this PR down to just the histogram fix and tests (that pass) 
and call it a day too.
    
    Thoughts? CC @mateiz @pwendell @rxin as it's kind of a core API issue.


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