[jira] [Commented] (SPARK-5270) Elegantly check if RDD is empty

2015-01-16 Thread Al M (JIRA)

[ 
https://issues.apache.org/jira/browse/SPARK-5270?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14279962#comment-14279962
 ] 

Al M commented on SPARK-5270:
-

Good point it's not a catch-all solution.  The rdd.partitions.size solution 
does work well in the case of empty RDDs created by Spark streaming.

 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



[jira] [Commented] (SPARK-5270) Elegantly check if RDD is empty

2015-01-16 Thread Sean Owen (JIRA)

[ 
https://issues.apache.org/jira/browse/SPARK-5270?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14280145#comment-14280145
 ] 

Sean Owen commented on SPARK-5270:
--

I think it would be nice to have a utility method like this indeed since it can 
wrap up all these options. Check for 0 partitions then check for first element. 
Mind if I make a PR?

 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



[jira] [Commented] (SPARK-5270) Elegantly check if RDD is empty

2015-01-16 Thread Al M (JIRA)

[ 
https://issues.apache.org/jira/browse/SPARK-5270?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14280260#comment-14280260
 ] 

Al M commented on SPARK-5270:
-

I don't mind at all.  I'd be really happy to have such a utility method in 
Spark.

 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



[jira] [Commented] (SPARK-5270) Elegantly check if RDD is empty

2015-01-16 Thread Apache Spark (JIRA)

[ 
https://issues.apache.org/jira/browse/SPARK-5270?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14280491#comment-14280491
 ] 

Apache Spark commented on SPARK-5270:
-

User 'srowen' has created a pull request for this issue:
https://github.com/apache/spark/pull/4074

 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



[jira] [Commented] (SPARK-5270) Elegantly check if RDD is empty

2015-01-15 Thread Al M (JIRA)

[ 
https://issues.apache.org/jira/browse/SPARK-5270?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14278983#comment-14278983
 ] 

Al M commented on SPARK-5270:
-

I just noticed that rdd.partitions.size is set to 0 for empty RDDs and  0 for 
RDDs with data; this is a far more elegant check than the others.

 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



[jira] [Commented] (SPARK-5270) Elegantly check if RDD is empty

2015-01-15 Thread Sean Owen (JIRA)

[ 
https://issues.apache.org/jira/browse/SPARK-5270?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14278993#comment-14278993
 ] 

Sean Owen commented on SPARK-5270:
--

I think it's conceivable to have an RDD with no elements but nonzero partitions 
though. Witness:

{code}
val empty = sc.parallelize(Array[Int]())
empty.count
...
0
empty.partitions.size
...
8
{code}

 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