[
https://issues.apache.org/jira/browse/FLINK-6987?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16064232#comment-16064232
]
ASF GitHub Bot commented on FLINK-6987:
---------------------------------------
Github user zhangminglei commented on a diff in the pull request:
https://github.com/apache/flink/pull/4168#discussion_r124175328
--- Diff:
flink-core/src/main/java/org/apache/flink/api/common/io/FileInputFormat.java ---
@@ -461,8 +463,9 @@ public LocatableInputSplitAssigner
getInputSplitAssigner(FileInputSplit[] splits
// take the desired number of splits into account
minNumSplits = Math.max(minNumSplits, this.numSplits);
-
- final Path path = this.filePath;
+
+ final Path path = new
Path(URLDecoder.decode(this.filePath.toString(),
Charset.defaultCharset().name()));
--- End diff --
I have updated the code. Please check again. One thing we should concern
though.
FYI, though, it is not very relevant to this issue here.
We can see, for **1** and **2** output results, they are both the same.
That is to say, call ```toString()``` from ```toURI()``` does not change the
internal of the result. But, if we call them in context of
```flink.core.fs.Path```. what I got is **3** and **4** outputs. **It seems
```new Path``` change someting stuff**. I guess that we should expect that not
happen under this context. Instead, I expect ```new
Path(parentDirTest.toURI().toString())``` return the same value as ```new
Path(parentDirTest.toURI())```. Now, they are not equal.
```File parentDirTest = new File("D:\\projects\\hello world");```
```System.out.println(parentDirTest.toURI()); ```
1. **Output: file:/D:/projects/hello%20world/**
```System.out.println(parentDirTest.toURI().toString());```
2. **Output: file:/D:/projects/hello%20world/**
```System.out.println(new Path(parentDirTest.toURI())); ```
3. **Output: file:/D:/projects/hello world/**
```System.out.println(new Path(parentDirTest.toURI().toString()));```
4. **Output: file:/D:/projects/hello%20world**
> TextInputFormatTest fails when run in path containing spaces
> ------------------------------------------------------------
>
> Key: FLINK-6987
> URL: https://issues.apache.org/jira/browse/FLINK-6987
> Project: Flink
> Issue Type: Bug
> Components: Build System
> Affects Versions: 1.3.1
> Reporter: Timo Walther
> Assignee: mingleizhang
>
> The test {{TextInputFormatTest.testNestedFileRead}} fails if the path
> contains spaces.
> Reason: "Test erroneous"
> I was building Flink on MacOS 10.12.5 and the folder was called "flink-1.3.1
> 2".
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)