Alluxio / Community

New Contributor Tasks for Alluxio
20 stars 38 forks source link

Check is a file by compare the URI path only to resolve the `null` authority URI #594

Closed maobaolong closed 3 years ago

maobaolong commented 3 years ago

underfs/hdfs/src/main/java/alluxio/underfs/hdfs/HdfsUnderFileSystem.java

  private FileStatus[] listStatusInternal(String path) throws IOException {
    FileStatus[] files;
    FileSystem hdfs = getFs();
    try {
      files = hdfs.listStatus(new Path(path));
    } catch (FileNotFoundException e) {
      return null;
    }
    // Check if path is a file
    if (files != null && files.length == 1 && files[0].getPath().toString().equals(path)) {

to


  private FileStatus[] listStatusInternal(String path) throws IOException {
    FileStatus[] files;
    FileSystem hdfs = getFs();
    Path thePath = new Path(path);
    try {
      files = hdfs.listStatus(thePath);
    } catch (FileNotFoundException e) {
      return null;
    }
    // Check if path is a file
    if (files != null && files.length == 1
        && files[0].getPath().toUri().getPath().equals(thePath.toUri().getPath())) {
maobaolong commented 3 years ago

@LuQQiu As I have no permission to add labels, please help to add a new-contributor label, thank you.

yyongycy commented 3 years ago

/assign @yyongycy

yyongycy commented 3 years ago

could anybody help trigger workflow of "https://github.com/Alluxio/alluxio/pull/13560"?

yyongycy commented 3 years ago

Code is merged. Could anybody close it?

LuQQiu commented 3 years ago

Thanks @yyongycy for fixing the null issue!