Skip to content

Conversation

@VinceShieh
Copy link

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]

Several places in MLlib use custom regexes or other approaches. Those should be
fixed to use the VersionUtils

Signed-off-by: VinceShieh <[email protected]>
@SparkQA
Copy link

SparkQA commented Sep 12, 2016

Test build #65241 has finished for PR 15055 at commit 72a87b0.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@VinceShieh
Copy link
Author

@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._
Copy link
Member

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.

Copy link
Author

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.

Copy link
Member

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?

Copy link
Author

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

Copy link
Member

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.

Copy link
Author

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]>
@SparkQA
Copy link

SparkQA commented Nov 17, 2016

Test build #3430 has finished for PR 15055 at commit 72a87b0.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Nov 17, 2016

Test build #68768 has finished for PR 15055 at commit b29b9be.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@srowen
Copy link
Member

srowen commented Nov 17, 2016

Merged to master/2.1

@asfgit asfgit closed this in de77c67 Nov 17, 2016
asfgit pushed a commit that referenced this pull request Nov 17, 2016
## 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]>
uzadude pushed a commit to uzadude/spark that referenced this pull request Jan 27, 2017
## 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.
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.

3 participants