-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-4397][Core] Reorganize 'implicit's to improve the API convenience #3262
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
1eda9e4
3ac4f07
9b73188
3bdcae2
185c12f
7266218
34641d4
52353de
2b5f5a4
9c27aff
fc30314
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 |
|---|---|---|
|
|
@@ -52,6 +52,7 @@ import org.apache.spark.storage._ | |
| import org.apache.spark.ui.SparkUI | ||
| import org.apache.spark.ui.jobs.JobProgressListener | ||
| import org.apache.spark.util._ | ||
| import org.apache.spark.WritableConverter.simpleWritableConverter | ||
|
|
||
| /** | ||
| * Main entry point for Spark functionality. A SparkContext represents the connection to a Spark | ||
|
|
@@ -1503,13 +1504,6 @@ object SparkContext extends Logging { | |
| arr.map(x => anyToWritable(x)).toArray) | ||
| } | ||
|
|
||
| // Helper objects for converting common types to Writable | ||
| private def simpleWritableConverter[T, W <: Writable: ClassTag](convert: W => T) | ||
| : WritableConverter[T] = { | ||
| val wClass = classTag[W].runtimeClass.asInstanceOf[Class[W]] | ||
| new WritableConverter[T](_ => wClass, x => convert(x.asInstanceOf[W])) | ||
| } | ||
|
|
||
| @deprecated("An API for backforward compatibility", "1.2.0") | ||
| def intWritableConverter(): WritableConverter[Int] = | ||
| simpleWritableConverter[Int, IntWritable](_.get) | ||
|
|
@@ -1769,10 +1763,10 @@ private[spark] class WritableConverter[T]( | |
| val convert: Writable => T) | ||
| extends Serializable | ||
|
|
||
| object WritableConverter { | ||
| private[spark] object WritableConverter { | ||
|
Member
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. Should this be
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. You should add some tests or examples that are outside the Spark package, but try to use it. My guess is that it needs to be public.
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. Actually that would be great to add for the whole patch; write some test programs in a different package (e.g. org.apache.sparktest) and make sure all the conversions can happen.
Member
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.
If it's
Member
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.
Moved ImplicitSuite to org.apache.sparktest.
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. Hmm, I find this pretty weird, so IMO we should make them public. I wouldn't be surprised if this gets removed in some version of Scala otherwise. |
||
|
|
||
| // Helper objects for converting common types to Writable | ||
| private def simpleWritableConverter[T, W <: Writable: ClassTag](convert: W => T) | ||
| private[spark] def simpleWritableConverter[T, W <: Writable: ClassTag](convert: W => T) | ||
| : WritableConverter[T] = { | ||
| val wClass = classTag[W].runtimeClass.asInstanceOf[Class[W]] | ||
| new WritableConverter[T](_ => wClass, x => convert(x.asInstanceOf[W])) | ||
|
|
||
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.
is the simpleWritableConverter in SparkContext still necessary?