-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-20936][CORE]Lack of an important case about the test of resolveURI in UtilsSuite, and add it as needed. #18158
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 all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -461,19 +461,17 @@ class UtilsSuite extends SparkFunSuite with ResetSystemProperties with Logging { | |
| def assertResolves(before: String, after: String): Unit = { | ||
| // This should test only single paths | ||
| assume(before.split(",").length === 1) | ||
| // Repeated invocations of resolveURI should yield the same result | ||
| def resolve(uri: String): String = Utils.resolveURI(uri).toString | ||
| assert(resolve(before) === after) | ||
| assert(resolve(after) === after) | ||
| // Repeated invocations of resolveURI should yield the same result | ||
| assert(resolve(resolve(after)) === after) | ||
| assert(resolve(resolve(resolve(after))) === after) | ||
| // Also test resolveURIs with single paths | ||
| assert(new URI(Utils.resolveURIs(before)) === new URI(after)) | ||
| assert(new URI(Utils.resolveURIs(after)) === new URI(after)) | ||
| } | ||
| val rawCwd = System.getProperty("user.dir") | ||
| val cwd = if (Utils.isWindows) s"/$rawCwd".replace("\\", "/") else rawCwd | ||
| assertResolves("hdfs:/root/spark.jar", "hdfs:/root/spark.jar") | ||
| assertResolves("hdfs:///root/spark.jar#app.jar", "hdfs:/root/spark.jar#app.jar") | ||
| assertResolves("hdfs:///root/spark.jar#app.jar", "hdfs:///root/spark.jar#app.jar") | ||
|
Member
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. There's no explanation of the change you are proposing. Please don't open PRs in this way
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. we need to add
Member
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. Do you mind if I ask to update the PR description with the reason for ^ in more details? We could focus on the topic more easily if there are details. This saves time for all of us (author and reviewers). Also, it helps to understand later when someone revisits this PR
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. yes let me make it clear. the function
Member
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. My question would be, what this change targets (e.g., adding missing test cases). If this tests the same thing before/after, I wonder if it is worth changing this. It is probably okay to add missing cases that does not change the existing tests but this changes the existing regression test cases. Are there missing test cases for this that detect the regressions within Spark's
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. what is the
Member
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. I think we do use it in
I think we should identify the cases. If the only reason is just meant to make the test code prettier but change the existing tests for no reason, I would go -1.
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. sorry for my pool english. could we ask more people to review this and get more opinions? @vanzin
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. yes, let me identify the cases between resolveURI and resolveURIs. what i meant is we should check |
||
| assertResolves("spark.jar", s"file:$cwd/spark.jar") | ||
| assertResolves("spark.jar#app.jar", s"file:$cwd/spark.jar#app.jar") | ||
| assertResolves("path to/file.txt", s"file:$cwd/path%20to/file.txt") | ||
|
|
@@ -482,20 +480,19 @@ class UtilsSuite extends SparkFunSuite with ResetSystemProperties with Logging { | |
| assertResolves("C:\\path to\\file.txt", "file:/C:/path%20to/file.txt") | ||
| } | ||
| assertResolves("file:/C:/path/to/file.txt", "file:/C:/path/to/file.txt") | ||
| assertResolves("file:///C:/path/to/file.txt", "file:/C:/path/to/file.txt") | ||
| assertResolves("file:///C:/path/to/file.txt", "file:///C:/path/to/file.txt") | ||
| assertResolves("file:/C:/file.txt#alias.txt", "file:/C:/file.txt#alias.txt") | ||
| assertResolves("file:foo", s"file:foo") | ||
| assertResolves("file:foo:baby", s"file:foo:baby") | ||
| assertResolves("file:foo", "file:foo") | ||
| assertResolves("file:foo:baby", "file:foo:baby") | ||
| } | ||
|
|
||
| test("resolveURIs with multiple paths") { | ||
| def assertResolves(before: String, after: String): Unit = { | ||
| assume(before.split(",").length > 1) | ||
| assert(Utils.resolveURIs(before) === after) | ||
| assert(Utils.resolveURIs(after) === after) | ||
| // Repeated invocations of resolveURIs should yield the same result | ||
| def resolve(uri: String): String = Utils.resolveURIs(uri) | ||
| assert(resolve(before) === after) | ||
| assert(resolve(after) === after) | ||
| // Repeated invocations of resolveURIs should yield the same result | ||
| assert(resolve(resolve(after)) === after) | ||
| assert(resolve(resolve(resolve(after))) === after) | ||
| } | ||
|
|
@@ -511,6 +508,8 @@ class UtilsSuite extends SparkFunSuite with ResetSystemProperties with Logging { | |
| s"hdfs:/jar1,file:/jar2,file:$cwd/jar3,file:/C:/pi.py%23py.pi,file:/C:/path%20to/jar4") | ||
| } | ||
| assertResolves(",jar1,jar2", s"file:$cwd/jar1,file:$cwd/jar2") | ||
| // Also test resolveURIs with single paths | ||
| assertResolves("hdfs:/root/spark.jar", "hdfs:/root/spark.jar") | ||
| } | ||
|
|
||
| test("nonLocalPaths") { | ||
|
|
||
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 think the change is OK @HyukjinKwon -- we do want to check that
beforeresolves toafterand this case seems missed in this fixture. Or do I miss something? The rest of the change is just for consistencyUh oh!
There was an error while loading. Please reload this page.
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.
Thanks for asking me. The initial change proposed looked testing several duplicated test cases and also changing existing test cases to me (I meant it looked changing what it tested before). I am fine with the current status.