Github user HyukjinKwon commented on the issue:

    https://github.com/apache/spark/pull/15866
  
    Thank you Sean. Actually, this is a bit annoying.
    
    Here is what happens in the original test.
    
    1. Writes a file to read back by `wholeTextFiles`. 
    
      ```scala
      scala> new File("C:\\a", "/part-0000")
      res10: java.io.File = C:\a\part-0000
      ```
    
    2. and then save the path in a map, `container`.
    
      ```scala
      scala> val container = Map("C:\\a/part-0000" -> "contents")
      res1: scala.collection.immutable.Map[String,String] = Map(C:\a/part-0000 
-> contents)
      ```
    
    3. then it compares the key in `container` to the collected paths from 
`wholeTextFiles`. The path should be
    
      ```scala
      scala> val path = "file:/C:/a/part-0000"
      path: String = file:/C:/a/part-0000
    
      scala> val actualPath = new URI(path).getPath
      res2: String = /C:/a/part-0000
      scala> 
      ```
    
    4. it ends up with..
    
      ```scala
      scala> container.contains(actualPath)
      res4: Boolean = false
      ```
    
    Just FWIW, (at least for myself to note this problem somewhere and re-visit 
sometime), it seems both back-slash and slash are fine with `java.io.File`.
    
    ```scala
    scala> new File("C:/a")
    res9: java.io.File = C:\a
    
    scala> new File("C:\\a", "/part-0000")
    res10: java.io.File = C:\a\part-0000
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to