-
Notifications
You must be signed in to change notification settings - Fork 29k
SPARK-1456 Remove view bounds on Ordered in favor of a context bound on Ordering. #410
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,8 +24,22 @@ import org.apache.spark.{Logging, RangePartitioner} | |
| /** | ||
| * Extra functions available on RDDs of (key, value) pairs where the key is sortable through | ||
| * an implicit conversion. Import `org.apache.spark.SparkContext._` at the top of your program to | ||
| * use these functions. They will work with any key type that has a `scala.math.Ordered` | ||
| * implementation. | ||
| * use these functions. They will work with any key type `K` that has an implicit `Ordering[K]` in | ||
| * scope. Ordering objects already exist for all of the standard primitive types. Users can also | ||
| * define their own orderings for custom types, or to override the default ordering. The implicit | ||
| * ordering that is in the closest scope will be used. | ||
| * | ||
| * {{{ | ||
| * import org.apache.spark.SparkContext._ | ||
| * | ||
| * val rdd: RDD[(String, Int)] = ... | ||
| * implicit val caseInsensitiveOrdering = new Ordering[String] { | ||
| * override def compare(a: String, b: String) = a.toLowerCase.compare(b.toLowerCase) | ||
| * } | ||
| * | ||
| * // Sort by key, using the above case insensitive ordering. | ||
| * rdd.sortByKey | ||
| * }}} | ||
| */ | ||
| class OrderedRDDFunctions[K : Ordering : ClassTag, | ||
|
Contributor
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. @marmbrus Do you mind updating the scaladoc above since now users can pass their own orderings in addition to an
Contributor
Author
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. done. |
||
| V: ClassTag, | ||
|
|
||
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.
a nit: put parenthesis around sortByKey