You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "David Morávek (Jira)" <ji...@apache.org> on 2020/01/16 13:08:00 UTC

[jira] [Resolved] (BEAM-9123) HadoopResourceId returns wrong directory name

     [ https://issues.apache.org/jira/browse/BEAM-9123?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Morávek resolved BEAM-9123.
---------------------------------
    Fix Version/s: 2.18.0
       Resolution: Fixed

> 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
>            Assignee: Marek Simunek
>            Priority: Major
>             Fix For: 2.18.0
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
>  _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  [getFileName()|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)