-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-17462][MLLIB]use VersionUtils to parse Spark version strings #15055
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
Several places in MLlib use custom regexes or other approaches. Those should be fixed to use the VersionUtils Signed-off-by: VinceShieh <[email protected]>
|
Test build #65241 has finished for PR 15055 at commit
|
|
@srowen @jkbradley do you have time to take a look at this one? |
| import org.apache.spark.sql._ | ||
| import org.apache.spark.sql.functions._ | ||
| import org.apache.spark.sql.types.{StructField, StructType} | ||
| import org.apache.spark.util.VersionUtils._ |
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.
In general I think we prefer importing classes rather than importing members, except where the latter is clearly clearer. I'm not sure it is here. It's minor either way.
Are there any other occurrences across the code? i want to try to solve these issues in one go.
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.
@srowen Sure, these are what I can find in ml/mllib.
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.
I meant, are there others in the whole code base, but, I don't actually see any more. Can you address the import?
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.
hmm, personally I think it's fine to keep it this way, though it's only 'majorVersion' needed here, so we can import org.apache.spark.util.VersionUtils.majorVersion instead. Sounds good to you? @srowen
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.
You can leave it. In general I think that when you find foo() in code one looks for foo in the same compilation unit, and it's a little distracting to find it was actually imported by itself. IDEs figure it out, sure, but this mechanism is really for things like importing a method used a lot or something. Anyway, we don't have a consistent approach in the code, so OK.
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.
got your point. I agree. I will change the importing to
import org.apache.spark.util.VersionUtils.majorVersion instead for clarity.
Signed-off-by: VinceShieh <[email protected]>
|
Test build #3430 has finished for PR 15055 at commit
|
|
Test build #68768 has finished for PR 15055 at commit
|
|
Merged to master/2.1 |
## What changes were proposed in this pull request? Several places in MLlib use custom regexes or other approaches to parse Spark versions. Those should be fixed to use the VersionUtils. This PR replaces custom regexes with VersionUtils to get Spark version numbers. ## How was this patch tested? Existing tests. Signed-off-by: VinceShieh vincent.xieintel.com Author: VinceShieh <[email protected]> Closes #15055 from VinceShieh/SPARK-17462. (cherry picked from commit de77c67) Signed-off-by: Sean Owen <[email protected]>
## What changes were proposed in this pull request? Several places in MLlib use custom regexes or other approaches to parse Spark versions. Those should be fixed to use the VersionUtils. This PR replaces custom regexes with VersionUtils to get Spark version numbers. ## How was this patch tested? Existing tests. Signed-off-by: VinceShieh vincent.xieintel.com Author: VinceShieh <[email protected]> Closes apache#15055 from VinceShieh/SPARK-17462.
What changes were proposed in this pull request?
Several places in MLlib use custom regexes or other approaches to parse Spark versions.
Those should be fixed to use the VersionUtils. This PR replaces custom regexes with
VersionUtils to get Spark version numbers.
How was this patch tested?
Existing tests.
Signed-off-by: VinceShieh [email protected]