You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "Marek Simunek (Jira)" <ji...@apache.org> on 2020/01/15 14:22:00 UTC

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

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

Marek Simunek updated BEAM-9123:
--------------------------------
    Description: 
 _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|#L68]] is using hadoop Path.getName() which returns everything after last slash.

 

  was:
 _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.




 


> 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
>            Priority: Major
>
>  _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|#L68]] is using hadoop Path.getName() which returns everything after last slash.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)