[ 
https://issues.apache.org/jira/browse/SPARK-5270?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Al M updated SPARK-5270:
------------------------
    Description: 
Right now there is no clean way to check if an RDD is empty.  As discussed 
here: 
http://apache-spark-user-list.1001560.n3.nabble.com/Testing-if-an-RDD-is-empty-td1678.html#a1679

I'd like a method rdd.isEmpty that returns a boolean.

This would be especially useful when using streams.  Sometimes my batches are 
huge in one stream, sometimes I get nothing for hours.  Still I have to run 
count() to check if there is anything in the RDD.  I can process my empty RDD 
like the others but it would be more efficient to just skip the empty ones.

I can also run first() and catch the exception; this is neither a clean nor 
fast solution.



  was:
Right now there is no clean way to check if an RDD is empty.  As discussed 
here: 
http://apache-spark-user-list.1001560.n3.nabble.com/Testing-if-an-RDD-is-empty-td1678.html#a1679

This is especially a problem when using streams.  Sometimes my batches are huge 
in one stream, sometimes i get nothing for hours.  Still I have to run count() 
to check if there is anything in the RDD.

I can also run first() and catch the exception; this is neither a clean nor 
fast solution.

I'd like a method rdd.isEmpty that returns a boolean.


> Elegantly check if RDD is empty
> -------------------------------
>
>                 Key: SPARK-5270
>                 URL: https://issues.apache.org/jira/browse/SPARK-5270
>             Project: Spark
>          Issue Type: Improvement
>    Affects Versions: 1.2.0
>         Environment: Centos 6
>            Reporter: Al M
>            Priority: Trivial
>
> Right now there is no clean way to check if an RDD is empty.  As discussed 
> here: 
> http://apache-spark-user-list.1001560.n3.nabble.com/Testing-if-an-RDD-is-empty-td1678.html#a1679
> I'd like a method rdd.isEmpty that returns a boolean.
> This would be especially useful when using streams.  Sometimes my batches are 
> huge in one stream, sometimes I get nothing for hours.  Still I have to run 
> count() to check if there is anything in the RDD.  I can process my empty RDD 
> like the others but it would be more efficient to just skip the empty ones.
> I can also run first() and catch the exception; this is neither a clean nor 
> fast solution.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to