Skip to content
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-5249] Added type specific set functions to SparkConf. #4042

Closed
wants to merge 3 commits into from
Closed

[SPARK-5249] Added type specific set functions to SparkConf. #4042

wants to merge 3 commits into from

Conversation

AdamGS
Copy link

@AdamGS AdamGS commented Jan 14, 2015

Just something that bothered me, might me comfortable to others.

@AmplabJenkins
Copy link

Can one of the admins verify this patch?

@@ -141,6 +141,26 @@ class SparkConf(loadDefaults: Boolean) extends Cloneable with Logging {
this
}

/** Set a boolean parameter */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than all these overloads, why not expose set(key: String, value: Any) since it is stored internally as a String from toString() anyway? This lets you add a generic setIfMissing too without so many methods.
Would you also then change the code that calls set to not have to make it into a String in the caller? to gain the benefit that this enables.

@AdamGS
Copy link
Author

AdamGS commented Jan 14, 2015

Made the changes, what do you think?

@@ -56,14 +56,14 @@ class SparkConf(loadDefaults: Boolean) extends Cloneable with Logging {
}

/** Set a configuration variable. */
def set(key: String, value: String): SparkConf = {
def set(key: String, value: Any): SparkConf = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, the problem is that this would break binary compatibility, I believe. I think this would have to be a new method. Are there cases in the code base where you can now replace a set("foo", bar.toString) with set("foo", bar)?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recompiled spark with this change and played around with spark-shell and everything seems to be fine.

@JoshRosen
Copy link
Contributor

If you run the MiMa checks, I'm pretty sure that this will break binary compatibility because it changes the signature of a public method. Let's see, though:

Jenkins, this is ok to test.

@pwendell
Copy link
Contributor

Hey @AdamGS - unfortunately we can't accept changes that break binary compatibility like this.

Jenkins, test this please.

@AdamGS
Copy link
Author

AdamGS commented Jan 15, 2015

@pwendell, will just adding the new set (and setIfMissing) methods work?

@pwendell
Copy link
Contributor

Yes, we could just add new ones. For this feature though, I guess I don't see why users cant' just call toString explicitly.

@AdamGS
Copy link
Author

AdamGS commented Jan 16, 2015

It's just a small thing that bothers me and might bother others, so I decided to try getting it into the code base because it makes for "prettier" code in my opinion.
Should I push the fixed version (two set/setIfMissing methods)?

@pwendell
Copy link
Contributor

I'd actually prefer not to have this in Spark. It's not really clear what we will do with an Any, and the user can really easily just call toString explicitly. I also looked at two other similar constructs in Java (the Java Properties class and Hadoop's Configuration class) and none of them offer this type of interface. There are multiple language API's that have this setConf and they all require string keys and values, it's just a bit inconsistent to do this kind of implicit conversion.

@pwendell
Copy link
Contributor

@JoshRosen or @srowen - what are your feelings on it?

@srowen
Copy link
Member

srowen commented Jan 18, 2015

It's a small thing, so I can't feel too strongly either way. I think it would have been a fine method to add in the beginning. Now, it's only really worth it if the code base is changed to use the simplified method, and that may not be worth it at this point.

@JoshRosen
Copy link
Contributor

I don't think that this change is worth it; having to call .toString() is a minor annoyance, but I think it's pretty low on the list of configuration-related headaches.

@pwendell
Copy link
Contributor

Okay - @AdamGS thanks for sending this patch but I think we'll pass on adding this API. Overall we're pretty conservative with adding API's like this if there isn't a compelling reason.

@pwendell
Copy link
Contributor

Let's close this issue.

@asfgit asfgit closed this in 1ac1c1d Jan 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants