You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by we...@apache.org on 2017/04/11 23:04:26 UTC
arrow git commit: ARROW-805: [C++] Don't throw IOError when listing
empty HDFS dir
Repository: arrow
Updated Branches:
refs/heads/master ab520cbc7 -> 5e5a5878d
ARROW-805: [C++] Don't throw IOError when listing empty HDFS dir
Author: Leif Walsh <le...@gmail.com>
Closes #528 from leifwalsh/ARROW-805 and squashes the following commits:
4e1bb05 [Leif Walsh] ARROW-805: [C++] Don't throw IOError when listing empty HDFS dir
Project: http://git-wip-us.apache.org/repos/asf/arrow/repo
Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/5e5a5878
Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/5e5a5878
Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/5e5a5878
Branch: refs/heads/master
Commit: 5e5a5878d7be62e0ae26ca0b45b4aafd761eb43d
Parents: ab520cb
Author: Leif Walsh <le...@gmail.com>
Authored: Tue Apr 11 19:04:21 2017 -0400
Committer: Wes McKinney <we...@twosigma.com>
Committed: Tue Apr 11 19:04:21 2017 -0400
----------------------------------------------------------------------
cpp/src/arrow/io/hdfs.cc | 7 +++++--
cpp/src/arrow/io/io-hdfs-test.cc | 4 ++++
2 files changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/arrow/blob/5e5a5878/cpp/src/arrow/io/hdfs.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/io/hdfs.cc b/cpp/src/arrow/io/hdfs.cc
index 408b85f..3510ba1 100644
--- a/cpp/src/arrow/io/hdfs.cc
+++ b/cpp/src/arrow/io/hdfs.cc
@@ -406,8 +406,11 @@ class HdfsClient::HdfsClientImpl {
// errno indicates error
//
// Note: errno is thread-locala
- if (errno == 0) { num_entries = 0; }
- { return Status::IOError("HDFS: list directory failed"); }
+ if (errno == 0) {
+ num_entries = 0;
+ } else {
+ return Status::IOError("HDFS: list directory failed");
+ }
}
// Allocate additional space for elements
http://git-wip-us.apache.org/repos/asf/arrow/blob/5e5a5878/cpp/src/arrow/io/io-hdfs-test.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/io/io-hdfs-test.cc b/cpp/src/arrow/io/io-hdfs-test.cc
index a2c9c52..0a9f5d9 100644
--- a/cpp/src/arrow/io/io-hdfs-test.cc
+++ b/cpp/src/arrow/io/io-hdfs-test.cc
@@ -170,8 +170,12 @@ TYPED_TEST(TestHdfsClient, CreateDirectory) {
ASSERT_OK(this->client_->CreateDirectory(path));
ASSERT_TRUE(this->client_->Exists(path));
+ std::vector<HdfsPathInfo> listing;
+ EXPECT_OK(this->client_->ListDirectory(path, &listing));
+ ASSERT_EQ(0, listing.size());
EXPECT_OK(this->client_->Delete(path, true));
ASSERT_FALSE(this->client_->Exists(path));
+ ASSERT_RAISES(IOError, this->client_->ListDirectory(path, &listing));
}
TYPED_TEST(TestHdfsClient, GetCapacityUsed) {