pan3793 commented on a change in pull request #28940:
URL: https://github.com/apache/spark/pull/28940#discussion_r447728376
##########
File path:
common/network-shuffle/src/test/java/org/apache/spark/network/shuffle/ExternalShuffleBlockResolverSuite.java
##########
@@ -146,12 +147,23 @@ public void jsonSerializationOfExecutorRegistration()
throws IOException {
@Test
public void testNormalizeAndInternPathname() {
- assertPathsMatch("/foo", "bar", "baz", "/foo/bar/baz");
- assertPathsMatch("//foo/", "bar/", "//baz", "/foo/bar/baz");
- assertPathsMatch("foo", "bar", "baz///", "foo/bar/baz");
- assertPathsMatch("/foo/", "/bar//", "/baz", "/foo/bar/baz");
- assertPathsMatch("/", "", "", "/");
- assertPathsMatch("/", "/", "/", "/");
+ assertPathsMatch("/foo", "bar", "baz",
+ File.separator + "foo" + File.separator + "bar" + File.separator +
"baz");
Review comment:
Done.
##########
File path:
common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExecutorDiskUtils.java
##########
@@ -50,14 +58,18 @@ public static File getFile(String[] localDirs, int
subDirsPerLocalDir, String fi
* the internal code in java.io.File would normalize it later, creating a
new "foo/bar"
* String copy. Unfortunately, we cannot just reuse the normalization code
that java.io.File
* uses, since it is in the package-private class java.io.FileSystem.
+ *
+ * On Windows, separator "\" is used instead of "/".
+ *
+ * "\\" is legal character in path name on Unix like OS, but illegal on
Windows.
*/
@VisibleForTesting
static String createNormalizedInternedPathname(String dir1, String dir2,
String fname) {
String pathname = dir1 + File.separator + dir2 + File.separator + fname;
Matcher m = MULTIPLE_SEPARATORS.matcher(pathname);
- pathname = m.replaceAll("/");
+ pathname = m.replaceAll(Matcher.quoteReplacement(File.separator));
// A single trailing slash needs to be taken care of separately
- if (pathname.length() > 1 && pathname.endsWith("/")) {
+ if (pathname.length() > 1 && pathname.endsWith(File.separator)) {
Review comment:
Done.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]