-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-8893] Add runtime checks against non-positive number of partitions #7285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although I think you could use require() here, the change itself LGTM. I don't see a reason to allow repartitioning to 0 partitions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although I think you could use
require()here, the change itself LGTM. I don't see a reason to allow repartitioning to 0 partitions.
Thanks! I've switched to require().
|
Test build #1009 has finished for PR 7285 at commit
|
|
|
|
Ah, I think this may have to be a check higher up, on the argument to |
|
+1 to @srowen's suggestion |
|
@darabos are you going to update this one? I think it can be an easy fix. |
There are valid cases where 0-size HashPartitioners are created (such as running groupByKey on an empty RDD). As long as they don't call getPartition there is nothing wrong with this. getPartition will try to divide by zero when it is called in this case, so there is no risk of silent mistakes. For negative partition counts getPartition would return bogus results, so the assertion against that remains.
The tests triggered the other assertion, in For negative partition counts |
|
It might be able to be a little lower down than |
|
Test build #1058 has finished for PR 7285 at commit
|
|
I think this is OK, and an improvement. Hm: if an RDD is empty, should it be OK to repartition to 0 partitions? that seems theoretically OK. Maybe not worth specially allowing. I think this change would prohibit it. |
https://issues.apache.org/jira/browse/SPARK-8893