-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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
[SPARK-22465][Core] Add a safety-check to RDD defaultPartitioner #20002
Closed
Closed
Changes from 10 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
176270b
[SPARK-22465][Core][WIP] Add a safety-check to RDD defaultPartitioner
be391a7
Merge remote-tracking branch 'origin-apache/master' into SPARK-22465
4b2dcac
Merge remote-tracking branch 'origin-apache/master' into SPARK-22465
ca6aa08
[SPARK-22465][Core][WIP] Fix Scala style checks
961e384
[SPARK-22465][Core][WIP] Changes after code review
8b35452
[SPARK-22465][Core][WIP] Scala style checks
4729d80
[SPARK-22465][Core][WIP] More Scala style checks
7d88e6c
Merge branch 'master' of github.com:apache/spark into SPARK-22465
6623227
Merge remote-tracking branch 'origin-apache/master' into SPARK-22465
3dd1ad8
[SPARK-22465][Core][WIP] Import scala.language.existentials to fix co…
62b17e9
[SPARK-22465][Core][WIP] Remove import scala.language.existentials; e…
3b08951
[SPARK-22465][Core][WIP] Add test for 9 vs 11 numPartitions case
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -259,6 +259,27 @@ class PartitioningSuite extends SparkFunSuite with SharedSparkContext with Priva | |
val partitioner = new RangePartitioner(22, rdd) | ||
assert(partitioner.numPartitions === 3) | ||
} | ||
|
||
test("defaultPartitioner") { | ||
val rdd1 = sc.parallelize((1 to 1000).map(x => (x, x)), 150) | ||
val rdd2 = sc | ||
.parallelize(Array((1, 2), (2, 3), (2, 4), (3, 4))) | ||
.partitionBy(new HashPartitioner(10)) | ||
val rdd3 = sc | ||
.parallelize(Array((1, 6), (7, 8), (3, 10), (5, 12), (13, 14))) | ||
.partitionBy(new HashPartitioner(100)) | ||
|
||
val partitioner1 = Partitioner.defaultPartitioner(rdd1, rdd2) | ||
val partitioner2 = Partitioner.defaultPartitioner(rdd2, rdd3) | ||
val partitioner3 = Partitioner.defaultPartitioner(rdd3, rdd1) | ||
val partitioner4 = Partitioner.defaultPartitioner(rdd1, rdd2, rdd3) | ||
|
||
assert(partitioner1.numPartitions == rdd1.getNumPartitions) | ||
assert(partitioner2.numPartitions == rdd3.getNumPartitions) | ||
assert(partitioner3.numPartitions == rdd3.getNumPartitions) | ||
assert(partitioner4.numPartitions == rdd3.getNumPartitions) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add a testcase such that numPartitions 9 vs 11 is not treated as an order of magnitude jump (to prevent future changes which end up breaking this). |
||
|
||
} | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Curious, why was this required ?
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.
Without this import, there was a compiler warning:
The build on Jenkins failed because of this warning.
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.
If we explicitly set the type, is it still required ? For example, with
val hasMaxPartitioner: Option[RDD[_]] = ...
?