Marek Simunek created BEAM-9123:
-----------------------------------
Summary: HadoopResourceId returns wrong directory name
Key: BEAM-9123
URL: https://issues.apache.org/jira/browse/BEAM-9123
Project: Beam
Issue Type: Bug
Components: io-java-hadoop-file-system
Affects Versions: 2.17.0
Reporter: Marek Simunek
_HadoopResourceId_ returns for directory uri wrong fileName() which doesnt
conform _ResourceId_ interface javadoc
{color:#629755}Returns the name of the file or directory..{color}
String {color:#ffc66d}getFilename{color}(){color:#cc7832}; {color}
{code:java}
URI hdfsClusterBaseUri = new URI(configuration.get("fs.defaultFS") + "/");
HadoopResourceId hadoopResourceId =
new HadoopResourceId(hdfsClusterBaseUri.resolve("/dirA/file1"));{code}
Expected behavior:
_hadoopResourceId.getCurrentDirectory().getFilename()_ returns *dirA*
Actual behavior:
_hadoopResourceId.getCurrentDirectory().getFilename()_ returns *""*
The problem is that uri for folder is ending with '*/*' and
[[getFilesystem|[https://github.com/apache/beam/blob/master/sdks/java/io/hadoop-file-system/src/main/java/org/apache/beam/sdk/io/hdfs/HadoopResourceId.java#L68]]
is using hadoop Path.getName() which returns everything after last slash.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)