Skip to content

listing empty HDFS directory returns an error instead of returning empty list #16414

@asfimport

Description

@asfimport

https://github.com/apache/arrow/blob/master/cpp/src/arrow/io/hdfs.cc#L409-L410

    if (entries == nullptr) {
      // If the directory is empty, entries is NULL but errno is 0. Non-zero
      // errno indicates error
      //
      // Note: errno is thread-locala
      if (errno == 0) { num_entries = 0; }
      { return Status::IOError("HDFS: list directory failed"); }
    }

I think that should have an else:

    if (entries == nullptr) {
      // If the directory is empty, entries is NULL but errno is 0. Non-zero
      // errno indicates error
      //
      // Note: errno is thread-locala
      if (errno == 0) {
        num_entries = 0;
      } else {
        return Status::IOError("HDFS: list directory failed");
      }
    }

Reporter: Leif Mortenson / @leifwalsh
Assignee: Leif Mortenson / @leifwalsh

Related issues:

Note: This issue was originally created as ARROW-805. Please see the migration documentation for further details.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions