Github user countmdm commented on a diff in the pull request:
https://github.com/apache/spark/pull/21456#discussion_r192576365
--- Diff:
common/network-shuffle/src/test/java/org/apache/spark/network/shuffle/ExternalShuffleBlockResolverSuite.java
---
@@ -135,4 +136,23 @@ public void jsonSerializationOfExecutorRegistration()
throws IOException {
"\"subDirsPerLocalDir\": 7, \"shuffleManager\": " + "\"" +
SORT_MANAGER + "\"}";
assertEquals(shuffleInfo, mapper.readValue(legacyShuffleJson,
ExecutorShuffleInfo.class));
}
+
+ @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("/", "/", "/", "/");
+ }
+
+ private void assertPathsMatch(String p1, String p2, String p3, String
expectedPathname) {
+ String normPathname =
+ ExternalShuffleBlockResolver.createNormalizedInternedPathname(p1,
p2, p3);
+ assertEquals(expectedPathname, normPathname);
+ File file = new File(normPathname);
+ String returnedPath = file.getPath();
+ assertTrue(normPathname == returnedPath);
--- End diff --
I am not sure when I've last seen {{assertSame}} in tests, so I am not sure
how many people understand well the difference between it and {{assertEquals}}.
Thus I personally think that '==' is better, because it's unambiguous. But if
you insist, no problem to replace.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]