GitHub user CodingCat opened a pull request: https://github.com/apache/spark/pull/135
SPARK-1240: handle the case with empty RDD when take sample https://spark-project.atlassian.net/browse/SPARK-1240 It seems that the current implementation does not handle the empty RDD case when run takeSample In this patch, before calling sample() inside takeSample API, I add a checker for this case and returns an empty Array when it's a empty RDD; also in sample(), I add a checker for the invalid fraction value In the test case, I also add several lines for this case You can merge this pull request into a Git repository by running: $ git pull https://github.com/CodingCat/spark SPARK-1240 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/135.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #135 ---- commit ad483fd0ad37e0df5b2dbd125af706454c7fbeb6 Author: CodingCat <zhunans...@gmail.com> Date: 2014-03-13T18:24:38Z handle the case with empty RDD when take sample ---- --- 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. ---