[ https://issues.apache.org/jira/browse/FLINK-18612?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17159691#comment-17159691 ]
Yun Gao edited comment on FLINK-18612 at 7/17/20, 5:45 AM: ----------------------------------------------------------- The issue is caused by when we create a file under the current user directory, we need to create the parent directory if not exists (in this case it is the current user directory), then # path.getParent() returns the current directory, namely "." in this case. # Flink Path object stores the path in a URI. However, according to [RFC-3986|https://tools.ietf.org/html/rfc3986] Section, 5.2.4, "." and ".." will be removed when the path is stored, thus Path.toUri().getPath() will return "". # When trying to create the directory, the Path is transformed into new File("") via _LocalFileSystem#pathToFile._ # Then the _ _condition to judge if the directory creation is successful in _LocalFileSystem#mkdirsInternal_, it will return false since _new File("").isDirectory()_ returns false. Therefore, when transforming the Path to File in the LocalFileSystem, if the path is "", we should return new File(".") instead, whose _isDirectory()_ judgement returns true. was (Author: gaoyunhaii): The issue is caused by when we create a file under the current user directory, we need to create the parent directory if not exists (in this case it is the current user directory), then # path.getParent() returns the current directory, namely "." in this case. # Flink Path object stores the path in a URI. However, according to [RFC-3986|https://tools.ietf.org/html/rfc3986] Section, 5.2.4, "." and ".." will be removed when the path is stored, thus Path.toUri().getPath() will return "". # When trying to create the directory, the Path is transformed into new File("") via _LocalFileSystem#pathToFile._ # Then the __ condition to judge if the directory creation is successful in _LocalFileSystem#mkdirsInternal_, it will return false since _new File("").isDirectory()_ returns false. Therefore, when transform the Path to File in the LocalFileSystem, if the path is "", we should return new File(".") instead, whose _isDirectory()_ judgement returns true. > WordCount example failure when setting relative output path > ----------------------------------------------------------- > > Key: FLINK-18612 > URL: https://issues.apache.org/jira/browse/FLINK-18612 > Project: Flink > Issue Type: Bug > Components: fs > Affects Versions: 1.11.0, 1.11.1 > Reporter: Zhijiang > Assignee: Yun Gao > Priority: Critical > Fix For: 1.12.0, 1.11.2 > > > The failure log can be found here > [log|https://pipelines.actions.githubusercontent.com/revSbsLpzrFApLL6BmCvScWt72tRe3wYUv7fCdCtThtI5bydk7/_apis/pipelines/1/runs/27244/signedlogcontent/21?urlExpires=2020-07-16T06%3A35%3A49.4559813Z&urlSigningMethod=HMACV1&urlSignature=%2FfAsJgIlIf%2BDitViRJYh0DAGJZjJwhsCGS219ZyniAA%3D]. > When execute the following command, we can reproduce this problem locally. > * bin/start-cluster.sh > * bin/flink run -p 1 examples/streaming/WordCount.jar --input input --output > result > It is caused by the > [commit|https://github.com/apache/flink/commit/a2deff2967b7de423b10f7f01a41c06565c37e62#diff-2010e422f5e43a971cd7134a9e0b9a5f > ]. -- This message was sent by Atlassian Jira (v8.3.4#803005)