You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ap...@apache.org on 2020/03/23 19:26:01 UTC
[arrow] branch master updated: ARROW-8145: [C++] Rename
FileSystem::GetTargetInfos to GetFileInfo
This is an automated email from the ASF dual-hosted git repository.
apitrou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/master by this push:
new a87b26c ARROW-8145: [C++] Rename FileSystem::GetTargetInfos to GetFileInfo
a87b26c is described below
commit a87b26ce6248b8ca600e23e79c9df50968ac7fda
Author: Antoine Pitrou <an...@python.org>
AuthorDate: Mon Mar 23 20:25:42 2020 +0100
ARROW-8145: [C++] Rename FileSystem::GetTargetInfos to GetFileInfo
Closes #6688 from pitrou/ARROW-8145-rename-get-target-infos
Authored-by: Antoine Pitrou <an...@python.org>
Signed-off-by: Antoine Pitrou <an...@python.org>
---
c_glib/arrow-glib/file-system.cpp | 6 +--
cpp/src/arrow/dataset/discovery.cc | 6 +--
cpp/src/arrow/filesystem/filesystem.cc | 22 ++++-----
cpp/src/arrow/filesystem/filesystem.h | 22 ++++-----
cpp/src/arrow/filesystem/filesystem_test.cc | 43 ++++++++---------
cpp/src/arrow/filesystem/hdfs.cc | 19 ++++----
cpp/src/arrow/filesystem/hdfs.h | 7 ++-
cpp/src/arrow/filesystem/hdfs_test.cc | 36 +++++++-------
cpp/src/arrow/filesystem/localfs.cc | 5 +-
cpp/src/arrow/filesystem/localfs.h | 7 ++-
cpp/src/arrow/filesystem/localfs_test.cc | 4 +-
cpp/src/arrow/filesystem/mockfs.cc | 5 +-
cpp/src/arrow/filesystem/mockfs.h | 7 ++-
cpp/src/arrow/filesystem/s3fs.cc | 4 +-
cpp/src/arrow/filesystem/s3fs.h | 7 ++-
cpp/src/arrow/filesystem/s3fs_narrative_test.cc | 16 +++----
cpp/src/arrow/filesystem/s3fs_test.cc | 54 ++++++++++-----------
cpp/src/arrow/filesystem/test_util.cc | 64 ++++++++++++-------------
cpp/src/arrow/filesystem/test_util.h | 52 ++++++++++----------
python/pyarrow/_dataset.pyx | 2 +-
python/pyarrow/_fs.pyx | 10 ++--
python/pyarrow/dataset.py | 4 +-
python/pyarrow/includes/libarrow_fs.pxd | 6 +--
python/pyarrow/tests/test_fs.py | 8 ++--
r/DESCRIPTION | 2 +-
r/R/filesystem.R | 6 +--
r/man/FileSystem.Rd | 2 +-
r/man/enums.Rd | 20 +++++++-
r/man/write_parquet.Rd | 3 +-
r/src/filesystem.cpp | 4 +-
r/tests/testthat/test-filesystem.R | 22 ++++-----
31 files changed, 240 insertions(+), 235 deletions(-)
diff --git a/c_glib/arrow-glib/file-system.cpp b/c_glib/arrow-glib/file-system.cpp
index ef7f401..40250a2 100644
--- a/c_glib/arrow-glib/file-system.cpp
+++ b/c_glib/arrow-glib/file-system.cpp
@@ -659,7 +659,7 @@ garrow_file_system_get_target_info(GArrowFileSystem *file_system,
GError **error)
{
auto arrow_file_system = garrow_file_system_get_raw(file_system);
- auto arrow_result = arrow_file_system->GetTargetInfo(path);
+ auto arrow_result = arrow_file_system->GetFileInfo(path);
if (garrow::check(error, arrow_result, "[file-system][get-target-info]")) {
const auto &arrow_file_info = *arrow_result;
return garrow_file_info_new_raw(arrow_file_info);
@@ -712,7 +712,7 @@ garrow_file_system_get_target_infos_paths(GArrowFileSystem *file_system,
for (gsize i = 0; i < n_paths; ++i) {
arrow_paths.push_back(paths[i]);
}
- return garrow_file_infos_new(arrow_file_system->GetTargetInfos(arrow_paths),
+ return garrow_file_infos_new(arrow_file_system->GetFileInfo(arrow_paths),
error,
"[file-system][get-target-infos][paths]");
}
@@ -742,7 +742,7 @@ garrow_file_system_get_target_infos_selector(GArrowFileSystem *file_system,
auto arrow_file_system = garrow_file_system_get_raw(file_system);
const auto &arrow_file_selector =
GARROW_FILE_SELECTOR_GET_PRIVATE(file_selector)->file_selector;
- return garrow_file_infos_new(arrow_file_system->GetTargetInfos(arrow_file_selector),
+ return garrow_file_infos_new(arrow_file_system->GetFileInfo(arrow_file_selector),
error,
"[file-system][get-target-infos][selector]");
}
diff --git a/cpp/src/arrow/dataset/discovery.cc b/cpp/src/arrow/dataset/discovery.cc
index 5880510..983bf1c 100644
--- a/cpp/src/arrow/dataset/discovery.cc
+++ b/cpp/src/arrow/dataset/discovery.cc
@@ -155,7 +155,7 @@ Result<fs::PathForest> FileSystemDatasetFactory::Filter(
Result<std::shared_ptr<DatasetFactory>> FileSystemDatasetFactory::Make(
std::shared_ptr<fs::FileSystem> filesystem, const std::vector<std::string>& paths,
std::shared_ptr<FileFormat> format, FileSystemFactoryOptions options) {
- ARROW_ASSIGN_OR_RAISE(auto files, filesystem->GetTargetInfos(paths));
+ ARROW_ASSIGN_OR_RAISE(auto files, filesystem->GetFileInfo(paths));
ARROW_ASSIGN_OR_RAISE(auto forest, fs::PathForest::Make(std::move(files)));
std::unordered_set<fs::FileInfo, fs::FileInfo::ByPath> missing;
@@ -167,7 +167,7 @@ Result<std::shared_ptr<DatasetFactory>> FileSystemDatasetFactory::Make(
for (auto&& path :
fs::internal::AncestorsFromBasePath(parent_path, ref.info().path())) {
- ARROW_ASSIGN_OR_RAISE(auto file, filesystem->GetTargetInfo(std::move(path)));
+ ARROW_ASSIGN_OR_RAISE(auto file, filesystem->GetFileInfo(std::move(path)));
missing.insert(std::move(file));
}
return Status::OK();
@@ -187,7 +187,7 @@ Result<std::shared_ptr<DatasetFactory>> FileSystemDatasetFactory::Make(
Result<std::shared_ptr<DatasetFactory>> FileSystemDatasetFactory::Make(
std::shared_ptr<fs::FileSystem> filesystem, fs::FileSelector selector,
std::shared_ptr<FileFormat> format, FileSystemFactoryOptions options) {
- ARROW_ASSIGN_OR_RAISE(auto files, filesystem->GetTargetInfos(selector));
+ ARROW_ASSIGN_OR_RAISE(auto files, filesystem->GetFileInfo(selector));
ARROW_ASSIGN_OR_RAISE(auto forest, fs::PathForest::Make(std::move(files)));
diff --git a/cpp/src/arrow/filesystem/filesystem.cc b/cpp/src/arrow/filesystem/filesystem.cc
index 7d80744..55eac13 100644
--- a/cpp/src/arrow/filesystem/filesystem.cc
+++ b/cpp/src/arrow/filesystem/filesystem.cc
@@ -117,12 +117,12 @@ FileSystem::~FileSystem() {}
Result<std::string> FileSystem::NormalizePath(std::string path) { return path; }
-Result<std::vector<FileInfo>> FileSystem::GetTargetInfos(
+Result<std::vector<FileInfo>> FileSystem::GetFileInfo(
const std::vector<std::string>& paths) {
std::vector<FileInfo> res;
res.reserve(paths.size());
for (const auto& path : paths) {
- ARROW_ASSIGN_OR_RAISE(FileInfo info, GetTargetInfo(path));
+ ARROW_ASSIGN_OR_RAISE(FileInfo info, GetFileInfo(path));
res.push_back(std::move(info));
}
return res;
@@ -190,17 +190,16 @@ Result<std::string> SubTreeFileSystem::NormalizePath(std::string path) {
return StripBase(std::move(normalized));
}
-Result<FileInfo> SubTreeFileSystem::GetTargetInfo(const std::string& path) {
- ARROW_ASSIGN_OR_RAISE(FileInfo info, base_fs_->GetTargetInfo(PrependBase(path)));
+Result<FileInfo> SubTreeFileSystem::GetFileInfo(const std::string& path) {
+ ARROW_ASSIGN_OR_RAISE(FileInfo info, base_fs_->GetFileInfo(PrependBase(path)));
RETURN_NOT_OK(FixInfo(&info));
return info;
}
-Result<std::vector<FileInfo>> SubTreeFileSystem::GetTargetInfos(
- const FileSelector& select) {
+Result<std::vector<FileInfo>> SubTreeFileSystem::GetFileInfo(const FileSelector& select) {
auto selector = select;
selector.base_dir = PrependBase(selector.base_dir);
- ARROW_ASSIGN_OR_RAISE(auto infos, base_fs_->GetTargetInfos(selector));
+ ARROW_ASSIGN_OR_RAISE(auto infos, base_fs_->GetFileInfo(selector));
for (auto& info : infos) {
RETURN_NOT_OK(FixInfo(&info));
}
@@ -289,15 +288,14 @@ SlowFileSystem::SlowFileSystem(std::shared_ptr<FileSystem> base_fs,
double average_latency, int32_t seed)
: base_fs_(base_fs), latencies_(io::LatencyGenerator::Make(average_latency, seed)) {}
-Result<FileInfo> SlowFileSystem::GetTargetInfo(const std::string& path) {
+Result<FileInfo> SlowFileSystem::GetFileInfo(const std::string& path) {
latencies_->Sleep();
- return base_fs_->GetTargetInfo(path);
+ return base_fs_->GetFileInfo(path);
}
-Result<std::vector<FileInfo>> SlowFileSystem::GetTargetInfos(
- const FileSelector& selector) {
+Result<std::vector<FileInfo>> SlowFileSystem::GetFileInfo(const FileSelector& selector) {
latencies_->Sleep();
- return base_fs_->GetTargetInfos(selector);
+ return base_fs_->GetFileInfo(selector);
}
Status SlowFileSystem::CreateDir(const std::string& path, bool recursive) {
diff --git a/cpp/src/arrow/filesystem/filesystem.h b/cpp/src/arrow/filesystem/filesystem.h
index d5da6cc..fe13939 100644
--- a/cpp/src/arrow/filesystem/filesystem.h
+++ b/cpp/src/arrow/filesystem/filesystem.h
@@ -174,16 +174,16 @@ class ARROW_EXPORT FileSystem {
/// A nonexistent or unreachable file returns an Ok status and
/// has a FileType of value NotFound. An error status indicates
/// a truly exceptional condition (low-level I/O error, etc.).
- virtual Result<FileInfo> GetTargetInfo(const std::string& path) = 0;
+ virtual Result<FileInfo> GetFileInfo(const std::string& path) = 0;
/// Same, for many targets at once.
- virtual Result<std::vector<FileInfo>> GetTargetInfos(
+ virtual Result<std::vector<FileInfo>> GetFileInfo(
const std::vector<std::string>& paths);
/// Same, according to a selector.
///
/// The selector's base directory will not be part of the results, even if
/// it exists.
- /// If it doesn't exist, see `FileSelector::allow_non_existent`.
- virtual Result<std::vector<FileInfo>> GetTargetInfos(const FileSelector& select) = 0;
+ /// If it doesn't exist, see `FileSelector::allow_not_found`.
+ virtual Result<std::vector<FileInfo>> GetFileInfo(const FileSelector& select) = 0;
/// Create a directory and subdirectories.
///
@@ -262,11 +262,10 @@ class ARROW_EXPORT SubTreeFileSystem : public FileSystem {
Result<std::string> NormalizePath(std::string path) override;
/// \cond FALSE
- using FileSystem::GetTargetInfo;
- using FileSystem::GetTargetInfos;
+ using FileSystem::GetFileInfo;
/// \endcond
- Result<FileInfo> GetTargetInfo(const std::string& path) override;
- Result<std::vector<FileInfo>> GetTargetInfos(const FileSelector& select) override;
+ Result<FileInfo> GetFileInfo(const std::string& path) override;
+ Result<std::vector<FileInfo>> GetFileInfo(const FileSelector& select) override;
Status CreateDir(const std::string& path, bool recursive = true) override;
@@ -315,10 +314,9 @@ class ARROW_EXPORT SlowFileSystem : public FileSystem {
std::string type_name() const override { return "slow"; }
- using FileSystem::GetTargetInfo;
- using FileSystem::GetTargetInfos;
- Result<FileInfo> GetTargetInfo(const std::string& path) override;
- Result<std::vector<FileInfo>> GetTargetInfos(const FileSelector& select) override;
+ using FileSystem::GetFileInfo;
+ Result<FileInfo> GetFileInfo(const std::string& path) override;
+ Result<std::vector<FileInfo>> GetFileInfo(const FileSelector& select) override;
Status CreateDir(const std::string& path, bool recursive = true) override;
diff --git a/cpp/src/arrow/filesystem/filesystem_test.cc b/cpp/src/arrow/filesystem/filesystem_test.cc
index cfb217a..bce70d7 100644
--- a/cpp/src/arrow/filesystem/filesystem_test.cc
+++ b/cpp/src/arrow/filesystem/filesystem_test.cc
@@ -362,29 +362,29 @@ TEST_F(TestMockFS, DeleteFile) {
CheckFiles({});
}
-TEST_F(TestMockFS, GetTargetInfo) {
+TEST_F(TestMockFS, GetFileInfo) {
ASSERT_OK(fs_->CreateDir("AB/CD"));
CreateFile("AB/CD/ef", "some data");
FileInfo info;
- ASSERT_OK_AND_ASSIGN(info, fs_->GetTargetInfo("AB"));
+ ASSERT_OK_AND_ASSIGN(info, fs_->GetFileInfo("AB"));
AssertFileInfo(info, "AB", FileType::Directory, time_);
ASSERT_EQ(info.base_name(), "AB");
- ASSERT_OK_AND_ASSIGN(info, fs_->GetTargetInfo("AB/CD/ef"));
+ ASSERT_OK_AND_ASSIGN(info, fs_->GetFileInfo("AB/CD/ef"));
AssertFileInfo(info, "AB/CD/ef", FileType::File, time_, 9);
ASSERT_EQ(info.base_name(), "ef");
// Invalid path
- ASSERT_RAISES(Invalid, fs_->GetTargetInfo("//foo//bar//baz//"));
+ ASSERT_RAISES(Invalid, fs_->GetFileInfo("//foo//bar//baz//"));
}
-TEST_F(TestMockFS, GetTargetInfosVector) {
+TEST_F(TestMockFS, GetFileInfoVector) {
ASSERT_OK(fs_->CreateDir("AB/CD"));
CreateFile("AB/CD/ef", "some data");
std::vector<FileInfo> infos;
ASSERT_OK_AND_ASSIGN(
- infos, fs_->GetTargetInfos({"AB", "AB/CD", "AB/zz", "zz", "XX/zz", "AB/CD/ef"}));
+ infos, fs_->GetFileInfo({"AB", "AB/CD", "AB/zz", "zz", "XX/zz", "AB/CD/ef"}));
ASSERT_EQ(infos.size(), 6);
AssertFileInfo(infos[0], "AB", FileType::Directory, time_);
AssertFileInfo(infos[1], "AB/CD", FileType::Directory, time_);
@@ -394,23 +394,23 @@ TEST_F(TestMockFS, GetTargetInfosVector) {
AssertFileInfo(infos[5], "AB/CD/ef", FileType::File, time_, 9);
// Invalid path
- ASSERT_RAISES(Invalid, fs_->GetTargetInfos({"AB", "AB/CD", "//foo//bar//baz//"}));
+ ASSERT_RAISES(Invalid, fs_->GetFileInfo({"AB", "AB/CD", "//foo//bar//baz//"}));
}
-TEST_F(TestMockFS, GetTargetInfosSelector) {
+TEST_F(TestMockFS, GetFileInfoSelector) {
ASSERT_OK(fs_->CreateDir("AB/CD"));
CreateFile("ab", "data");
FileSelector s;
s.base_dir = "";
std::vector<FileInfo> infos;
- ASSERT_OK_AND_ASSIGN(infos, fs_->GetTargetInfos(s));
+ ASSERT_OK_AND_ASSIGN(infos, fs_->GetFileInfo(s));
ASSERT_EQ(infos.size(), 2);
AssertFileInfo(infos[0], "AB", FileType::Directory, time_);
AssertFileInfo(infos[1], "ab", FileType::File, time_, 4);
s.recursive = true;
- ASSERT_OK_AND_ASSIGN(infos, fs_->GetTargetInfos(s));
+ ASSERT_OK_AND_ASSIGN(infos, fs_->GetFileInfo(s));
ASSERT_EQ(infos.size(), 3);
AssertFileInfo(infos[0], "AB", FileType::Directory, time_);
AssertFileInfo(infos[1], "AB/CD", FileType::Directory, time_);
@@ -418,7 +418,7 @@ TEST_F(TestMockFS, GetTargetInfosSelector) {
// Invalid path
s.base_dir = "//foo//bar//baz//";
- ASSERT_RAISES(Invalid, fs_->GetTargetInfos(s));
+ ASSERT_RAISES(Invalid, fs_->GetFileInfo(s));
}
TEST_F(TestMockFS, OpenOutputStream) {
@@ -655,7 +655,7 @@ TEST_F(TestSubTreeFileSystem, OpenAppendStream) {
CheckFiles({{"sub/tree/ab", time_, "some data"}});
}
-TEST_F(TestSubTreeFileSystem, GetTargetInfo) {
+TEST_F(TestSubTreeFileSystem, GetFileInfo) {
ASSERT_OK(subfs_->CreateDir("AB/CD"));
AssertFileInfo(subfs_.get(), "AB", FileType::Directory, time_);
@@ -667,15 +667,14 @@ TEST_F(TestSubTreeFileSystem, GetTargetInfo) {
AssertFileInfo(subfs_.get(), "nonexistent", FileType::NotFound);
}
-TEST_F(TestSubTreeFileSystem, GetTargetInfosVector) {
+TEST_F(TestSubTreeFileSystem, GetFileInfoVector) {
std::vector<FileInfo> infos;
ASSERT_OK(subfs_->CreateDir("AB/CD"));
CreateFile("ab", "data");
CreateFile("AB/cd", "other data");
- ASSERT_OK_AND_ASSIGN(infos,
- subfs_->GetTargetInfos({"ab", "AB", "AB/cd", "nonexistent"}));
+ ASSERT_OK_AND_ASSIGN(infos, subfs_->GetFileInfo({"ab", "AB", "AB/cd", "nonexistent"}));
ASSERT_EQ(infos.size(), 4);
AssertFileInfo(infos[0], "ab", FileType::File, time_, 4);
AssertFileInfo(infos[1], "AB", FileType::Directory, time_);
@@ -683,7 +682,7 @@ TEST_F(TestSubTreeFileSystem, GetTargetInfosVector) {
AssertFileInfo(infos[3], "nonexistent", FileType::NotFound);
}
-TEST_F(TestSubTreeFileSystem, GetTargetInfosSelector) {
+TEST_F(TestSubTreeFileSystem, GetFileInfoSelector) {
std::vector<FileInfo> infos;
FileSelector selector;
@@ -694,13 +693,13 @@ TEST_F(TestSubTreeFileSystem, GetTargetInfosSelector) {
selector.base_dir = "AB";
selector.recursive = false;
- ASSERT_OK_AND_ASSIGN(infos, subfs_->GetTargetInfos(selector));
+ ASSERT_OK_AND_ASSIGN(infos, subfs_->GetFileInfo(selector));
ASSERT_EQ(infos.size(), 2);
AssertFileInfo(infos[0], "AB/CD", FileType::Directory, time_);
AssertFileInfo(infos[1], "AB/cd", FileType::File, time_, 5);
selector.recursive = true;
- ASSERT_OK_AND_ASSIGN(infos, subfs_->GetTargetInfos(selector));
+ ASSERT_OK_AND_ASSIGN(infos, subfs_->GetFileInfo(selector));
ASSERT_EQ(infos.size(), 3);
AssertFileInfo(infos[0], "AB/CD", FileType::Directory, time_);
AssertFileInfo(infos[1], "AB/CD/ef", FileType::File, time_, 6);
@@ -708,13 +707,13 @@ TEST_F(TestSubTreeFileSystem, GetTargetInfosSelector) {
selector.base_dir = "";
selector.recursive = false;
- ASSERT_OK_AND_ASSIGN(infos, subfs_->GetTargetInfos(selector));
+ ASSERT_OK_AND_ASSIGN(infos, subfs_->GetFileInfo(selector));
ASSERT_EQ(infos.size(), 2);
AssertFileInfo(infos[0], "AB", FileType::Directory, time_);
AssertFileInfo(infos[1], "ab", FileType::File, time_, 4);
selector.recursive = true;
- ASSERT_OK_AND_ASSIGN(infos, subfs_->GetTargetInfos(selector));
+ ASSERT_OK_AND_ASSIGN(infos, subfs_->GetFileInfo(selector));
ASSERT_EQ(infos.size(), 5);
AssertFileInfo(infos[0], "AB", FileType::Directory, time_);
AssertFileInfo(infos[1], "AB/CD", FileType::Directory, time_);
@@ -723,9 +722,9 @@ TEST_F(TestSubTreeFileSystem, GetTargetInfosSelector) {
AssertFileInfo(infos[4], "ab", FileType::File, time_, 4);
selector.base_dir = "nonexistent";
- ASSERT_RAISES(IOError, subfs_->GetTargetInfos(selector));
+ ASSERT_RAISES(IOError, subfs_->GetFileInfo(selector));
selector.allow_not_found = true;
- ASSERT_OK_AND_ASSIGN(infos, subfs_->GetTargetInfos(selector));
+ ASSERT_OK_AND_ASSIGN(infos, subfs_->GetFileInfo(selector));
ASSERT_EQ(infos.size(), 0);
}
diff --git a/cpp/src/arrow/filesystem/hdfs.cc b/cpp/src/arrow/filesystem/hdfs.cc
index 5cdacf7..7c7cc7d 100644
--- a/cpp/src/arrow/filesystem/hdfs.cc
+++ b/cpp/src/arrow/filesystem/hdfs.cc
@@ -63,7 +63,7 @@ class HadoopFileSystem::Impl {
return Status::OK();
}
- Result<FileInfo> GetTargetInfo(const std::string& path) {
+ Result<FileInfo> GetFileInfo(const std::string& path) {
FileInfo info;
io::HdfsPathInfo path_info;
auto status = client_->GetPathInfo(path, &path_info);
@@ -84,7 +84,7 @@ class HadoopFileSystem::Impl {
Status st = client_->ListDirectory(path, &children);
if (!st.ok()) {
if (select.allow_not_found) {
- ARROW_ASSIGN_OR_RAISE(auto info, GetTargetInfo(path));
+ ARROW_ASSIGN_OR_RAISE(auto info, GetFileInfo(path));
if (info.type() == FileType::NotFound) {
return Status::OK();
}
@@ -112,7 +112,7 @@ class HadoopFileSystem::Impl {
return Status::OK();
}
- Result<std::vector<FileInfo>> GetTargetInfos(const FileSelector& select) {
+ Result<std::vector<FileInfo>> GetFileInfo(const FileSelector& select) {
std::vector<FileInfo> results;
std::string wd;
@@ -125,10 +125,10 @@ class HadoopFileSystem::Impl {
wd = wd_uri.path();
}
- ARROW_ASSIGN_OR_RAISE(auto info, GetTargetInfo(select.base_dir));
+ ARROW_ASSIGN_OR_RAISE(auto info, GetFileInfo(select.base_dir));
if (info.type() == FileType::File) {
return Status::Invalid(
- "GetTargetInfos expects base_dir of selector to be a directory, while '",
+ "GetFileInfo expects base_dir of selector to be a directory, while '",
select.base_dir, "' is a file");
}
RETURN_NOT_OK(StatSelector(wd, select.base_dir, select, 0, &results));
@@ -326,13 +326,12 @@ Result<std::shared_ptr<HadoopFileSystem>> HadoopFileSystem::Make(
return ptr;
}
-Result<FileInfo> HadoopFileSystem::GetTargetInfo(const std::string& path) {
- return impl_->GetTargetInfo(path);
+Result<FileInfo> HadoopFileSystem::GetFileInfo(const std::string& path) {
+ return impl_->GetFileInfo(path);
}
-Result<std::vector<FileInfo>> HadoopFileSystem::GetTargetInfos(
- const FileSelector& select) {
- return impl_->GetTargetInfos(select);
+Result<std::vector<FileInfo>> HadoopFileSystem::GetFileInfo(const FileSelector& select) {
+ return impl_->GetFileInfo(select);
}
Status HadoopFileSystem::CreateDir(const std::string& path, bool recursive) {
diff --git a/cpp/src/arrow/filesystem/hdfs.h b/cpp/src/arrow/filesystem/hdfs.h
index 080380e..ba589e5 100644
--- a/cpp/src/arrow/filesystem/hdfs.h
+++ b/cpp/src/arrow/filesystem/hdfs.h
@@ -62,11 +62,10 @@ class ARROW_EXPORT HadoopFileSystem : public FileSystem {
std::string type_name() const override { return "hdfs"; }
/// \cond FALSE
- using FileSystem::GetTargetInfo;
- using FileSystem::GetTargetInfos;
+ using FileSystem::GetFileInfo;
/// \endcond
- Result<FileInfo> GetTargetInfo(const std::string& path) override;
- Result<std::vector<FileInfo>> GetTargetInfos(const FileSelector& select) override;
+ Result<FileInfo> GetFileInfo(const std::string& path) override;
+ Result<std::vector<FileInfo>> GetFileInfo(const FileSelector& select) override;
Status CreateDir(const std::string& path, bool recursive = true) override;
diff --git a/cpp/src/arrow/filesystem/hdfs_test.cc b/cpp/src/arrow/filesystem/hdfs_test.cc
index 3829278..571b687 100644
--- a/cpp/src/arrow/filesystem/hdfs_test.cc
+++ b/cpp/src/arrow/filesystem/hdfs_test.cc
@@ -105,7 +105,7 @@ class TestHadoopFileSystem : public ::testing::Test {
AssertFileInfo(uri_fs.get(), "AB", FileType::NotFound);
}
- void TestGetTargetInfos(const std::string& base_dir) {
+ void TestGetFileInfo(const std::string& base_dir) {
std::vector<FileInfo> infos;
ASSERT_OK(fs_->CreateDir(base_dir + "AB"));
@@ -117,9 +117,9 @@ class TestHadoopFileSystem : public ::testing::Test {
// With single path
FileInfo info;
- ASSERT_OK_AND_ASSIGN(info, fs_->GetTargetInfo(base_dir + "AB"));
+ ASSERT_OK_AND_ASSIGN(info, fs_->GetFileInfo(base_dir + "AB"));
AssertFileInfo(info, base_dir + "AB", FileType::Directory);
- ASSERT_OK_AND_ASSIGN(info, fs_->GetTargetInfo(base_dir + "AB/data"));
+ ASSERT_OK_AND_ASSIGN(info, fs_->GetFileInfo(base_dir + "AB/data"));
AssertFileInfo(info, base_dir + "AB/data", FileType::File, 9);
// With selector
@@ -127,14 +127,14 @@ class TestHadoopFileSystem : public ::testing::Test {
selector.base_dir = base_dir + "AB";
selector.recursive = false;
- ASSERT_OK_AND_ASSIGN(infos, fs_->GetTargetInfos(selector));
+ ASSERT_OK_AND_ASSIGN(infos, fs_->GetFileInfo(selector));
ASSERT_EQ(infos.size(), 3);
AssertFileInfo(infos[0], base_dir + "AB/CD", FileType::Directory);
AssertFileInfo(infos[1], base_dir + "AB/EF", FileType::Directory);
AssertFileInfo(infos[2], base_dir + "AB/data", FileType::File);
selector.recursive = true;
- ASSERT_OK_AND_ASSIGN(infos, fs_->GetTargetInfos(selector));
+ ASSERT_OK_AND_ASSIGN(infos, fs_->GetFileInfo(selector));
ASSERT_EQ(infos.size(), 5);
AssertFileInfo(infos[0], base_dir + "AB/CD", FileType::Directory);
AssertFileInfo(infos[1], base_dir + "AB/EF", FileType::Directory);
@@ -143,14 +143,14 @@ class TestHadoopFileSystem : public ::testing::Test {
AssertFileInfo(infos[4], base_dir + "AB/data", FileType::File, 9);
selector.max_recursion = 0;
- ASSERT_OK_AND_ASSIGN(infos, fs_->GetTargetInfos(selector));
+ ASSERT_OK_AND_ASSIGN(infos, fs_->GetFileInfo(selector));
ASSERT_EQ(infos.size(), 3);
AssertFileInfo(infos[0], base_dir + "AB/CD", FileType::Directory);
AssertFileInfo(infos[1], base_dir + "AB/EF", FileType::Directory);
AssertFileInfo(infos[2], base_dir + "AB/data", FileType::File);
selector.max_recursion = 1;
- ASSERT_OK_AND_ASSIGN(infos, fs_->GetTargetInfos(selector));
+ ASSERT_OK_AND_ASSIGN(infos, fs_->GetFileInfo(selector));
ASSERT_EQ(infos.size(), 4);
AssertFileInfo(infos[0], base_dir + "AB/CD", FileType::Directory);
AssertFileInfo(infos[1], base_dir + "AB/EF", FileType::Directory);
@@ -159,11 +159,11 @@ class TestHadoopFileSystem : public ::testing::Test {
selector.base_dir = base_dir + "XYZ";
selector.allow_not_found = true;
- ASSERT_OK_AND_ASSIGN(infos, fs_->GetTargetInfos(selector));
+ ASSERT_OK_AND_ASSIGN(infos, fs_->GetFileInfo(selector));
ASSERT_EQ(infos.size(), 0);
selector.allow_not_found = false;
- ASSERT_RAISES(IOError, fs_->GetTargetInfos(selector));
+ ASSERT_RAISES(IOError, fs_->GetFileInfo(selector));
ASSERT_OK(fs_->DeleteDir(base_dir + "AB"));
AssertFileInfo(fs_.get(), base_dir + "AB", FileType::NotFound);
@@ -246,18 +246,18 @@ TEST_F(TestHadoopFileSystem, WriteReadFile) {
ASSERT_OK(this->fs_->DeleteDir("CD"));
}
-TEST_F(TestHadoopFileSystem, GetTargetInfosRelative) {
- // Test GetTargetInfos() with relative paths
+TEST_F(TestHadoopFileSystem, GetFileInfoRelative) {
+ // Test GetFileInfo() with relative paths
SKIP_IF_NO_DRIVER();
- this->TestGetTargetInfos("");
+ this->TestGetFileInfo("");
}
-TEST_F(TestHadoopFileSystem, GetTargetInfosAbsolute) {
- // Test GetTargetInfos() with absolute paths
+TEST_F(TestHadoopFileSystem, GetFileInfoAbsolute) {
+ // Test GetFileInfo() with absolute paths
SKIP_IF_NO_DRIVER();
- this->TestGetTargetInfos("/");
+ this->TestGetFileInfo("/");
}
TEST_F(TestHadoopFileSystem, RelativeVsAbsolutePaths) {
@@ -281,15 +281,15 @@ TEST_F(TestHadoopFileSystem, MoveDir) {
std::string directory_name_src = "AB";
std::string directory_name_dest = "CD";
ASSERT_OK(this->fs_->CreateDir(directory_name_src));
- ASSERT_OK_AND_ASSIGN(info, this->fs_->GetTargetInfo(directory_name_src));
+ ASSERT_OK_AND_ASSIGN(info, this->fs_->GetFileInfo(directory_name_src));
AssertFileInfo(info, directory_name_src, FileType::Directory);
// move file
ASSERT_OK(this->fs_->Move(directory_name_src, directory_name_dest));
- ASSERT_OK_AND_ASSIGN(info, this->fs_->GetTargetInfo(directory_name_src));
+ ASSERT_OK_AND_ASSIGN(info, this->fs_->GetFileInfo(directory_name_src));
ASSERT_TRUE(info.type() == FileType::NotFound);
- ASSERT_OK_AND_ASSIGN(info, this->fs_->GetTargetInfo(directory_name_dest));
+ ASSERT_OK_AND_ASSIGN(info, this->fs_->GetFileInfo(directory_name_dest));
AssertFileInfo(info, directory_name_dest, FileType::Directory);
ASSERT_OK(this->fs_->DeleteDir(directory_name_dest));
}
diff --git a/cpp/src/arrow/filesystem/localfs.cc b/cpp/src/arrow/filesystem/localfs.cc
index 4d6bb14..6d5d0e7 100644
--- a/cpp/src/arrow/filesystem/localfs.cc
+++ b/cpp/src/arrow/filesystem/localfs.cc
@@ -245,13 +245,12 @@ Result<std::string> LocalFileSystem::NormalizePath(std::string path) {
return fn.ToString();
}
-Result<FileInfo> LocalFileSystem::GetTargetInfo(const std::string& path) {
+Result<FileInfo> LocalFileSystem::GetFileInfo(const std::string& path) {
ARROW_ASSIGN_OR_RAISE(auto fn, PlatformFilename::FromString(path));
return StatFile(fn.ToNative());
}
-Result<std::vector<FileInfo>> LocalFileSystem::GetTargetInfos(
- const FileSelector& select) {
+Result<std::vector<FileInfo>> LocalFileSystem::GetFileInfo(const FileSelector& select) {
ARROW_ASSIGN_OR_RAISE(auto fn, PlatformFilename::FromString(select.base_dir));
std::vector<FileInfo> results;
RETURN_NOT_OK(StatSelector(fn, select, 0, &results));
diff --git a/cpp/src/arrow/filesystem/localfs.h b/cpp/src/arrow/filesystem/localfs.h
index f659d4e..97140ce 100644
--- a/cpp/src/arrow/filesystem/localfs.h
+++ b/cpp/src/arrow/filesystem/localfs.h
@@ -53,11 +53,10 @@ class ARROW_EXPORT LocalFileSystem : public FileSystem {
Result<std::string> NormalizePath(std::string path) override;
/// \cond FALSE
- using FileSystem::GetTargetInfo;
- using FileSystem::GetTargetInfos;
+ using FileSystem::GetFileInfo;
/// \endcond
- Result<FileInfo> GetTargetInfo(const std::string& path) override;
- Result<std::vector<FileInfo>> GetTargetInfos(const FileSelector& select) override;
+ Result<FileInfo> GetFileInfo(const std::string& path) override;
+ Result<std::vector<FileInfo>> GetFileInfo(const FileSelector& select) override;
Status CreateDir(const std::string& path, bool recursive = true) override;
diff --git a/cpp/src/arrow/filesystem/localfs_test.cc b/cpp/src/arrow/filesystem/localfs_test.cc
index 90b7a84..e85805c 100644
--- a/cpp/src/arrow/filesystem/localfs_test.cc
+++ b/cpp/src/arrow/filesystem/localfs_test.cc
@@ -339,7 +339,7 @@ TYPED_TEST(TestLocalFS, DirectoryMTime) {
TimePoint t2 = CurrentTimePoint();
std::vector<FileInfo> infos;
- ASSERT_OK_AND_ASSIGN(infos, this->fs_->GetTargetInfos({"AB", "AB/CD/EF", "xxx"}));
+ ASSERT_OK_AND_ASSIGN(infos, this->fs_->GetFileInfo({"AB", "AB/CD/EF", "xxx"}));
ASSERT_EQ(infos.size(), 3);
AssertFileInfo(infos[0], "AB", FileType::Directory);
AssertFileInfo(infos[1], "AB/CD/EF", FileType::Directory);
@@ -362,7 +362,7 @@ TYPED_TEST(TestLocalFS, FileMTime) {
TimePoint t2 = CurrentTimePoint();
std::vector<FileInfo> infos;
- ASSERT_OK_AND_ASSIGN(infos, this->fs_->GetTargetInfos({"AB", "AB/CD/ab", "xxx"}));
+ ASSERT_OK_AND_ASSIGN(infos, this->fs_->GetFileInfo({"AB", "AB/CD/ab", "xxx"}));
ASSERT_EQ(infos.size(), 3);
AssertFileInfo(infos[0], "AB", FileType::Directory);
AssertFileInfo(infos[1], "AB/CD/ab", FileType::File, 4);
diff --git a/cpp/src/arrow/filesystem/mockfs.cc b/cpp/src/arrow/filesystem/mockfs.cc
index ede6069..e55197c 100644
--- a/cpp/src/arrow/filesystem/mockfs.cc
+++ b/cpp/src/arrow/filesystem/mockfs.cc
@@ -473,7 +473,7 @@ Status MockFileSystem::DeleteFile(const std::string& path) {
return Status::OK();
}
-Result<FileInfo> MockFileSystem::GetTargetInfo(const std::string& path) {
+Result<FileInfo> MockFileSystem::GetFileInfo(const std::string& path) {
auto parts = SplitAbstractPath(path);
RETURN_NOT_OK(ValidateAbstractPathParts(parts));
@@ -488,8 +488,7 @@ Result<FileInfo> MockFileSystem::GetTargetInfo(const std::string& path) {
return info;
}
-Result<std::vector<FileInfo>> MockFileSystem::GetTargetInfos(
- const FileSelector& selector) {
+Result<std::vector<FileInfo>> MockFileSystem::GetFileInfo(const FileSelector& selector) {
auto parts = SplitAbstractPath(selector.base_dir);
RETURN_NOT_OK(ValidateAbstractPathParts(parts));
diff --git a/cpp/src/arrow/filesystem/mockfs.h b/cpp/src/arrow/filesystem/mockfs.h
index 2f4e0cf..1dac61c 100644
--- a/cpp/src/arrow/filesystem/mockfs.h
+++ b/cpp/src/arrow/filesystem/mockfs.h
@@ -65,10 +65,9 @@ class ARROW_EXPORT MockFileSystem : public FileSystem {
// XXX It's not very practical to have to explicitly declare inheritance
// of default overrides.
- using FileSystem::GetTargetInfo;
- using FileSystem::GetTargetInfos;
- Result<FileInfo> GetTargetInfo(const std::string& path) override;
- Result<std::vector<FileInfo>> GetTargetInfos(const FileSelector& select) override;
+ using FileSystem::GetFileInfo;
+ Result<FileInfo> GetFileInfo(const std::string& path) override;
+ Result<std::vector<FileInfo>> GetFileInfo(const FileSelector& select) override;
Status CreateDir(const std::string& path, bool recursive = true) override;
diff --git a/cpp/src/arrow/filesystem/s3fs.cc b/cpp/src/arrow/filesystem/s3fs.cc
index c46c350..b86bc0e 100644
--- a/cpp/src/arrow/filesystem/s3fs.cc
+++ b/cpp/src/arrow/filesystem/s3fs.cc
@@ -1190,7 +1190,7 @@ Result<std::shared_ptr<S3FileSystem>> S3FileSystem::Make(const S3Options& option
return ptr;
}
-Result<FileInfo> S3FileSystem::GetTargetInfo(const std::string& s) {
+Result<FileInfo> S3FileSystem::GetFileInfo(const std::string& s) {
S3Path path;
RETURN_NOT_OK(S3Path::FromString(s, &path));
FileInfo info;
@@ -1256,7 +1256,7 @@ Result<FileInfo> S3FileSystem::GetTargetInfo(const std::string& s) {
}
}
-Result<std::vector<FileInfo>> S3FileSystem::GetTargetInfos(const FileSelector& select) {
+Result<std::vector<FileInfo>> S3FileSystem::GetFileInfo(const FileSelector& select) {
S3Path base_path;
RETURN_NOT_OK(S3Path::FromString(select.base_dir, &base_path));
diff --git a/cpp/src/arrow/filesystem/s3fs.h b/cpp/src/arrow/filesystem/s3fs.h
index b932641..0afee5c 100644
--- a/cpp/src/arrow/filesystem/s3fs.h
+++ b/cpp/src/arrow/filesystem/s3fs.h
@@ -88,11 +88,10 @@ class ARROW_EXPORT S3FileSystem : public FileSystem {
std::string type_name() const override { return "s3"; }
/// \cond FALSE
- using FileSystem::GetTargetInfo;
- using FileSystem::GetTargetInfos;
+ using FileSystem::GetFileInfo;
/// \endcond
- Result<FileInfo> GetTargetInfo(const std::string& path) override;
- Result<std::vector<FileInfo>> GetTargetInfos(const FileSelector& select) override;
+ Result<FileInfo> GetFileInfo(const std::string& path) override;
+ Result<std::vector<FileInfo>> GetFileInfo(const FileSelector& select) override;
Status CreateDir(const std::string& path, bool recursive = true) override;
diff --git a/cpp/src/arrow/filesystem/s3fs_narrative_test.cc b/cpp/src/arrow/filesystem/s3fs_narrative_test.cc
index a8c6ebf..b47df2f 100644
--- a/cpp/src/arrow/filesystem/s3fs_narrative_test.cc
+++ b/cpp/src/arrow/filesystem/s3fs_narrative_test.cc
@@ -103,7 +103,7 @@ void TestBucket(int argc, char** argv) {
select.base_dir = "";
select.allow_not_found = false;
select.recursive = false;
- ASSERT_OK_AND_ASSIGN(infos, fs->GetTargetInfos(select));
+ ASSERT_OK_AND_ASSIGN(infos, fs->GetFileInfo(select));
ASSERT_EQ(infos.size(), 0) << "Bucket should be empty, perhaps use --clear?";
// Create directory structure
@@ -117,9 +117,9 @@ void TestBucket(int argc, char** argv) {
CreateFile(fs.get(), "Dir1/File2", "second data");
CreateFile(fs.get(), "Dir2/Subdir/File3", "third data");
- // GetTargetInfos(Selector)
+ // GetFileInfo(Selector)
select.base_dir = "";
- ASSERT_OK_AND_ASSIGN(infos, fs->GetTargetInfos(select));
+ ASSERT_OK_AND_ASSIGN(infos, fs->GetFileInfo(select));
ASSERT_EQ(infos.size(), 4);
SortInfos(&infos);
AssertFileInfo(infos[0], "Dir1", FileType::Directory);
@@ -128,22 +128,22 @@ void TestBucket(int argc, char** argv) {
AssertFileInfo(infos[3], "File1", FileType::File, 10);
select.base_dir = "zzzz";
- ASSERT_RAISES_PRINT("GetTargetInfos(Selector) with nonexisting base_dir", IOError,
- fs->GetTargetInfos(select));
+ ASSERT_RAISES_PRINT("GetFileInfo(Selector) with nonexisting base_dir", IOError,
+ fs->GetFileInfo(select));
select.allow_not_found = true;
- ASSERT_OK_AND_ASSIGN(infos, fs->GetTargetInfos(select));
+ ASSERT_OK_AND_ASSIGN(infos, fs->GetFileInfo(select));
ASSERT_EQ(infos.size(), 0);
select.base_dir = "Dir1";
select.allow_not_found = false;
- ASSERT_OK_AND_ASSIGN(infos, fs->GetTargetInfos(select));
+ ASSERT_OK_AND_ASSIGN(infos, fs->GetFileInfo(select));
ASSERT_EQ(infos.size(), 2);
AssertFileInfo(infos[0], "Dir1/File2", FileType::File, 11);
AssertFileInfo(infos[1], "Dir1/Subdir", FileType::Directory);
select.base_dir = "Dir2";
select.recursive = true;
- ASSERT_OK_AND_ASSIGN(infos, fs->GetTargetInfos(select));
+ ASSERT_OK_AND_ASSIGN(infos, fs->GetFileInfo(select));
ASSERT_EQ(infos.size(), 2);
AssertFileInfo(infos[0], "Dir2/Subdir", FileType::Directory);
AssertFileInfo(infos[1], "Dir2/Subdir/File3", FileType::File, 10);
diff --git a/cpp/src/arrow/filesystem/s3fs_test.cc b/cpp/src/arrow/filesystem/s3fs_test.cc
index baf46ae..f69100a 100644
--- a/cpp/src/arrow/filesystem/s3fs_test.cc
+++ b/cpp/src/arrow/filesystem/s3fs_test.cc
@@ -422,11 +422,9 @@ class TestS3FS : public S3TestMixin {
std::shared_ptr<S3FileSystem> fs_;
};
-TEST_F(TestS3FS, GetTargetInfoRoot) {
- AssertFileInfo(fs_.get(), "", FileType::Directory);
-}
+TEST_F(TestS3FS, GetFileInfoRoot) { AssertFileInfo(fs_.get(), "", FileType::Directory); }
-TEST_F(TestS3FS, GetTargetInfoBucket) {
+TEST_F(TestS3FS, GetFileInfoBucket) {
AssertFileInfo(fs_.get(), "bucket", FileType::Directory);
AssertFileInfo(fs_.get(), "empty-bucket", FileType::Directory);
AssertFileInfo(fs_.get(), "nonexistent-bucket", FileType::NotFound);
@@ -436,7 +434,7 @@ TEST_F(TestS3FS, GetTargetInfoBucket) {
AssertFileInfo(fs_.get(), "nonexistent-bucket/", FileType::NotFound);
}
-TEST_F(TestS3FS, GetTargetInfoObject) {
+TEST_F(TestS3FS, GetFileInfoObject) {
// "Directories"
AssertFileInfo(fs_.get(), "bucket/emptydir", FileType::Directory, kNoSize);
AssertFileInfo(fs_.get(), "bucket/somedir", FileType::Directory, kNoSize);
@@ -458,13 +456,13 @@ TEST_F(TestS3FS, GetTargetInfoObject) {
AssertFileInfo(fs_.get(), "non-existent-bucket/somed/", FileType::NotFound);
}
-TEST_F(TestS3FS, GetTargetInfosSelector) {
+TEST_F(TestS3FS, GetFileInfoSelector) {
FileSelector select;
std::vector<FileInfo> infos;
// Root dir
select.base_dir = "";
- ASSERT_OK_AND_ASSIGN(infos, fs_->GetTargetInfos(select));
+ ASSERT_OK_AND_ASSIGN(infos, fs_->GetFileInfo(select));
ASSERT_EQ(infos.size(), 2);
SortInfos(&infos);
AssertFileInfo(infos[0], "bucket", FileType::Directory);
@@ -472,18 +470,18 @@ TEST_F(TestS3FS, GetTargetInfosSelector) {
// Empty bucket
select.base_dir = "empty-bucket";
- ASSERT_OK_AND_ASSIGN(infos, fs_->GetTargetInfos(select));
+ ASSERT_OK_AND_ASSIGN(infos, fs_->GetFileInfo(select));
ASSERT_EQ(infos.size(), 0);
// Nonexistent bucket
select.base_dir = "nonexistent-bucket";
- ASSERT_RAISES(IOError, fs_->GetTargetInfos(select));
+ ASSERT_RAISES(IOError, fs_->GetFileInfo(select));
select.allow_not_found = true;
- ASSERT_OK_AND_ASSIGN(infos, fs_->GetTargetInfos(select));
+ ASSERT_OK_AND_ASSIGN(infos, fs_->GetFileInfo(select));
ASSERT_EQ(infos.size(), 0);
select.allow_not_found = false;
// Non-empty bucket
select.base_dir = "bucket";
- ASSERT_OK_AND_ASSIGN(infos, fs_->GetTargetInfos(select));
+ ASSERT_OK_AND_ASSIGN(infos, fs_->GetFileInfo(select));
SortInfos(&infos);
ASSERT_EQ(infos.size(), 3);
AssertFileInfo(infos[0], "bucket/emptydir", FileType::Directory);
@@ -492,45 +490,45 @@ TEST_F(TestS3FS, GetTargetInfosSelector) {
// Empty "directory"
select.base_dir = "bucket/emptydir";
- ASSERT_OK_AND_ASSIGN(infos, fs_->GetTargetInfos(select));
+ ASSERT_OK_AND_ASSIGN(infos, fs_->GetFileInfo(select));
ASSERT_EQ(infos.size(), 0);
// Non-empty "directories"
select.base_dir = "bucket/somedir";
- ASSERT_OK_AND_ASSIGN(infos, fs_->GetTargetInfos(select));
+ ASSERT_OK_AND_ASSIGN(infos, fs_->GetFileInfo(select));
ASSERT_EQ(infos.size(), 1);
AssertFileInfo(infos[0], "bucket/somedir/subdir", FileType::Directory);
select.base_dir = "bucket/somedir/subdir";
- ASSERT_OK_AND_ASSIGN(infos, fs_->GetTargetInfos(select));
+ ASSERT_OK_AND_ASSIGN(infos, fs_->GetFileInfo(select));
ASSERT_EQ(infos.size(), 1);
AssertFileInfo(infos[0], "bucket/somedir/subdir/subfile", FileType::File, 8);
// Nonexistent
select.base_dir = "bucket/nonexistent";
- ASSERT_RAISES(IOError, fs_->GetTargetInfos(select));
+ ASSERT_RAISES(IOError, fs_->GetFileInfo(select));
select.allow_not_found = true;
- ASSERT_OK_AND_ASSIGN(infos, fs_->GetTargetInfos(select));
+ ASSERT_OK_AND_ASSIGN(infos, fs_->GetFileInfo(select));
ASSERT_EQ(infos.size(), 0);
select.allow_not_found = false;
// Trailing slashes
select.base_dir = "empty-bucket/";
- ASSERT_OK_AND_ASSIGN(infos, fs_->GetTargetInfos(select));
+ ASSERT_OK_AND_ASSIGN(infos, fs_->GetFileInfo(select));
ASSERT_EQ(infos.size(), 0);
select.base_dir = "nonexistent-bucket/";
- ASSERT_RAISES(IOError, fs_->GetTargetInfos(select));
+ ASSERT_RAISES(IOError, fs_->GetFileInfo(select));
select.base_dir = "bucket/";
- ASSERT_OK_AND_ASSIGN(infos, fs_->GetTargetInfos(select));
+ ASSERT_OK_AND_ASSIGN(infos, fs_->GetFileInfo(select));
SortInfos(&infos);
ASSERT_EQ(infos.size(), 3);
}
-TEST_F(TestS3FS, GetTargetInfosSelectorRecursive) {
+TEST_F(TestS3FS, GetFileInfoSelectorRecursive) {
FileSelector select;
std::vector<FileInfo> infos;
select.recursive = true;
// Root dir
select.base_dir = "";
- ASSERT_OK_AND_ASSIGN(infos, fs_->GetTargetInfos(select));
+ ASSERT_OK_AND_ASSIGN(infos, fs_->GetFileInfo(select));
ASSERT_EQ(infos.size(), 7);
SortInfos(&infos);
AssertFileInfo(infos[0], "bucket", FileType::Directory);
@@ -543,12 +541,12 @@ TEST_F(TestS3FS, GetTargetInfosSelectorRecursive) {
// Empty bucket
select.base_dir = "empty-bucket";
- ASSERT_OK_AND_ASSIGN(infos, fs_->GetTargetInfos(select));
+ ASSERT_OK_AND_ASSIGN(infos, fs_->GetFileInfo(select));
ASSERT_EQ(infos.size(), 0);
// Non-empty bucket
select.base_dir = "bucket";
- ASSERT_OK_AND_ASSIGN(infos, fs_->GetTargetInfos(select));
+ ASSERT_OK_AND_ASSIGN(infos, fs_->GetFileInfo(select));
SortInfos(&infos);
ASSERT_EQ(infos.size(), 5);
AssertFileInfo(infos[0], "bucket/emptydir", FileType::Directory);
@@ -559,12 +557,12 @@ TEST_F(TestS3FS, GetTargetInfosSelectorRecursive) {
// Empty "directory"
select.base_dir = "bucket/emptydir";
- ASSERT_OK_AND_ASSIGN(infos, fs_->GetTargetInfos(select));
+ ASSERT_OK_AND_ASSIGN(infos, fs_->GetFileInfo(select));
ASSERT_EQ(infos.size(), 0);
// Non-empty "directories"
select.base_dir = "bucket/somedir";
- ASSERT_OK_AND_ASSIGN(infos, fs_->GetTargetInfos(select));
+ ASSERT_OK_AND_ASSIGN(infos, fs_->GetFileInfo(select));
SortInfos(&infos);
ASSERT_EQ(infos.size(), 2);
AssertFileInfo(infos[0], "bucket/somedir/subdir", FileType::Directory);
@@ -630,7 +628,7 @@ TEST_F(TestS3FS, DeleteDir) {
// Empty "directory"
ASSERT_OK(fs_->DeleteDir("bucket/emptydir"));
- ASSERT_OK_AND_ASSIGN(infos, fs_->GetTargetInfos(select));
+ ASSERT_OK_AND_ASSIGN(infos, fs_->GetFileInfo(select));
ASSERT_EQ(infos.size(), 2);
SortInfos(&infos);
AssertFileInfo(infos[0], "bucket/somedir", FileType::Directory);
@@ -638,14 +636,14 @@ TEST_F(TestS3FS, DeleteDir) {
// Non-empty "directory"
ASSERT_OK(fs_->DeleteDir("bucket/somedir"));
- ASSERT_OK_AND_ASSIGN(infos, fs_->GetTargetInfos(select));
+ ASSERT_OK_AND_ASSIGN(infos, fs_->GetFileInfo(select));
ASSERT_EQ(infos.size(), 1);
AssertFileInfo(infos[0], "bucket/somefile", FileType::File);
// Leaving parent "directory" empty
ASSERT_OK(fs_->CreateDir("bucket/newdir/newsub/newsubsub"));
ASSERT_OK(fs_->DeleteDir("bucket/newdir/newsub"));
- ASSERT_OK_AND_ASSIGN(infos, fs_->GetTargetInfos(select));
+ ASSERT_OK_AND_ASSIGN(infos, fs_->GetFileInfo(select));
ASSERT_EQ(infos.size(), 2);
SortInfos(&infos);
AssertFileInfo(infos[0], "bucket/newdir", FileType::Directory); // still exists
diff --git a/cpp/src/arrow/filesystem/test_util.cc b/cpp/src/arrow/filesystem/test_util.cc
index 187b759..a688695 100644
--- a/cpp/src/arrow/filesystem/test_util.cc
+++ b/cpp/src/arrow/filesystem/test_util.cc
@@ -41,7 +41,7 @@ std::vector<FileInfo> GetAllWithType(FileSystem* fs, FileType type) {
FileSelector selector;
selector.base_dir = "";
selector.recursive = true;
- std::vector<FileInfo> infos = std::move(fs->GetTargetInfos(selector)).ValueOrDie();
+ std::vector<FileInfo> infos = std::move(fs->GetFileInfo(selector)).ValueOrDie();
std::vector<FileInfo> result;
for (const auto& info : infos) {
if (info.type() == type) {
@@ -84,7 +84,7 @@ void ValidateTimePoint(TimePoint tp) { ASSERT_GE(tp.time_since_epoch().count(),
void AssertFileContents(FileSystem* fs, const std::string& path,
const std::string& expected_data) {
- ASSERT_OK_AND_ASSIGN(FileInfo info, fs->GetTargetInfo(path));
+ ASSERT_OK_AND_ASSIGN(FileInfo info, fs->GetFileInfo(path));
ASSERT_EQ(info.type(), FileType::File) << "For path '" << path << "'";
ASSERT_EQ(info.size(), static_cast<int64_t>(expected_data.length()))
<< "For path '" << path << "'";
@@ -136,25 +136,25 @@ void AssertFileInfo(const FileInfo& info, const std::string& path, FileType type
}
void AssertFileInfo(FileSystem* fs, const std::string& path, FileType type) {
- ASSERT_OK_AND_ASSIGN(FileInfo info, fs->GetTargetInfo(path));
+ ASSERT_OK_AND_ASSIGN(FileInfo info, fs->GetFileInfo(path));
AssertFileInfo(info, path, type);
}
void AssertFileInfo(FileSystem* fs, const std::string& path, FileType type,
TimePoint mtime) {
- ASSERT_OK_AND_ASSIGN(FileInfo info, fs->GetTargetInfo(path));
+ ASSERT_OK_AND_ASSIGN(FileInfo info, fs->GetFileInfo(path));
AssertFileInfo(info, path, type, mtime);
}
void AssertFileInfo(FileSystem* fs, const std::string& path, FileType type,
TimePoint mtime, int64_t size) {
- ASSERT_OK_AND_ASSIGN(FileInfo info, fs->GetTargetInfo(path));
+ ASSERT_OK_AND_ASSIGN(FileInfo info, fs->GetFileInfo(path));
AssertFileInfo(info, path, type, mtime, size);
}
void AssertFileInfo(FileSystem* fs, const std::string& path, FileType type,
int64_t size) {
- ASSERT_OK_AND_ASSIGN(FileInfo info, fs->GetTargetInfo(path));
+ ASSERT_OK_AND_ASSIGN(FileInfo info, fs->GetFileInfo(path));
AssertFileInfo(info, path, type, size);
}
@@ -491,7 +491,7 @@ void GenericFileSystemTest::TestCopyFile(FileSystem* fs) {
AssertAllFiles(fs, {"AB/abc", "EF/ghi", "def"});
}
-void GenericFileSystemTest::TestGetTargetInfo(FileSystem* fs) {
+void GenericFileSystemTest::TestGetFileInfo(FileSystem* fs) {
ASSERT_OK(fs->CreateDir("AB/CD/EF"));
CreateFile(fs, "AB/CD/ghi", "some data");
CreateFile(fs, "AB/CD/jkl", "some other data");
@@ -499,7 +499,7 @@ void GenericFileSystemTest::TestGetTargetInfo(FileSystem* fs) {
FileInfo info;
TimePoint first_dir_time, first_file_time;
- ASSERT_OK_AND_ASSIGN(info, fs->GetTargetInfo("AB"));
+ ASSERT_OK_AND_ASSIGN(info, fs->GetFileInfo("AB"));
AssertFileInfo(info, "AB", FileType::Directory);
ASSERT_EQ(info.base_name(), "AB");
ASSERT_EQ(info.size(), kNoSize);
@@ -508,7 +508,7 @@ void GenericFileSystemTest::TestGetTargetInfo(FileSystem* fs) {
ValidateTimePoint(first_dir_time);
}
- ASSERT_OK_AND_ASSIGN(info, fs->GetTargetInfo("AB/CD/EF"));
+ ASSERT_OK_AND_ASSIGN(info, fs->GetFileInfo("AB/CD/EF"));
AssertFileInfo(info, "AB/CD/EF", FileType::Directory);
ASSERT_EQ(info.base_name(), "EF");
ASSERT_EQ(info.size(), kNoSize);
@@ -518,7 +518,7 @@ void GenericFileSystemTest::TestGetTargetInfo(FileSystem* fs) {
AssertDurationBetween(info.mtime() - first_dir_time, 0.0, kTimeSlack);
}
- ASSERT_OK_AND_ASSIGN(info, fs->GetTargetInfo("AB/CD/ghi"));
+ ASSERT_OK_AND_ASSIGN(info, fs->GetFileInfo("AB/CD/ghi"));
AssertFileInfo(info, "AB/CD/ghi", FileType::File, 9);
ASSERT_EQ(info.base_name(), "ghi");
first_file_time = info.mtime();
@@ -527,26 +527,26 @@ void GenericFileSystemTest::TestGetTargetInfo(FileSystem* fs) {
if (have_directory_mtimes()) {
AssertDurationBetween(first_file_time - first_dir_time, 0.0, kTimeSlack);
}
- ASSERT_OK_AND_ASSIGN(info, fs->GetTargetInfo("AB/CD/jkl"));
+ ASSERT_OK_AND_ASSIGN(info, fs->GetFileInfo("AB/CD/jkl"));
AssertFileInfo(info, "AB/CD/jkl", FileType::File, 15);
// This file was created after the one above
AssertDurationBetween(info.mtime() - first_file_time, 0.0, kTimeSlack);
- ASSERT_OK_AND_ASSIGN(info, fs->GetTargetInfo("zz"));
+ ASSERT_OK_AND_ASSIGN(info, fs->GetFileInfo("zz"));
AssertFileInfo(info, "zz", FileType::NotFound);
ASSERT_EQ(info.base_name(), "zz");
ASSERT_EQ(info.size(), kNoSize);
ASSERT_EQ(info.mtime(), kNoTime);
}
-void GenericFileSystemTest::TestGetTargetInfosVector(FileSystem* fs) {
+void GenericFileSystemTest::TestGetFileInfoVector(FileSystem* fs) {
ASSERT_OK(fs->CreateDir("AB/CD"));
CreateFile(fs, "AB/CD/ghi", "some data");
std::vector<FileInfo> infos;
TimePoint dir_time, file_time;
ASSERT_OK_AND_ASSIGN(
- infos, fs->GetTargetInfos({"AB", "AB/CD", "AB/zz", "zz", "XX/zz", "AB/CD/ghi"}));
+ infos, fs->GetFileInfo({"AB", "AB/CD", "AB/zz", "zz", "XX/zz", "AB/CD/ghi"}));
ASSERT_EQ(infos.size(), 6);
AssertFileInfo(infos[0], "AB", FileType::Directory);
dir_time = infos[0].mtime();
@@ -570,16 +570,16 @@ void GenericFileSystemTest::TestGetTargetInfosVector(FileSystem* fs) {
// Check the mtime is the same from one call to the other
FileInfo info;
if (have_directory_mtimes()) {
- ASSERT_OK_AND_ASSIGN(info, fs->GetTargetInfo("AB"));
+ ASSERT_OK_AND_ASSIGN(info, fs->GetFileInfo("AB"));
AssertFileInfo(info, "AB", FileType::Directory);
ASSERT_EQ(info.mtime(), dir_time);
}
- ASSERT_OK_AND_ASSIGN(info, fs->GetTargetInfo("AB/CD/ghi"));
+ ASSERT_OK_AND_ASSIGN(info, fs->GetFileInfo("AB/CD/ghi"));
AssertFileInfo(info, "AB/CD/ghi", FileType::File, 9);
ASSERT_EQ(info.mtime(), file_time);
}
-void GenericFileSystemTest::TestGetTargetInfosSelector(FileSystem* fs) {
+void GenericFileSystemTest::TestGetFileInfoSelector(FileSystem* fs) {
ASSERT_OK(fs->CreateDir("AB/CD"));
CreateFile(fs, "abc", "data");
CreateFile(fs, "AB/def", "some data");
@@ -590,7 +590,7 @@ void GenericFileSystemTest::TestGetTargetInfosSelector(FileSystem* fs) {
FileSelector s;
s.base_dir = "";
std::vector<FileInfo> infos;
- ASSERT_OK_AND_ASSIGN(infos, fs->GetTargetInfos(s));
+ ASSERT_OK_AND_ASSIGN(infos, fs->GetFileInfo(s));
// Need to sort results to make testing deterministic
SortInfos(&infos);
ASSERT_EQ(infos.size(), 2);
@@ -602,14 +602,14 @@ void GenericFileSystemTest::TestGetTargetInfosSelector(FileSystem* fs) {
AssertFileInfo(infos[1], "abc", FileType::File, 4);
s.base_dir = "AB";
- ASSERT_OK_AND_ASSIGN(infos, fs->GetTargetInfos(s));
+ ASSERT_OK_AND_ASSIGN(infos, fs->GetFileInfo(s));
SortInfos(&infos);
ASSERT_EQ(infos.size(), 2);
AssertFileInfo(infos[0], "AB/CD", FileType::Directory);
AssertFileInfo(infos[1], "AB/def", FileType::File, 9);
s.base_dir = "AB/CD";
- ASSERT_OK_AND_ASSIGN(infos, fs->GetTargetInfos(s));
+ ASSERT_OK_AND_ASSIGN(infos, fs->GetFileInfo(s));
SortInfos(&infos);
ASSERT_EQ(infos.size(), 2);
AssertFileInfo(infos[0], "AB/CD/ghi", FileType::File, 15);
@@ -623,7 +623,7 @@ void GenericFileSystemTest::TestGetTargetInfosSelector(FileSystem* fs) {
// Recursive
s.base_dir = "AB";
s.recursive = true;
- ASSERT_OK_AND_ASSIGN(infos, fs->GetTargetInfos(s));
+ ASSERT_OK_AND_ASSIGN(infos, fs->GetFileInfo(s));
SortInfos(&infos);
ASSERT_EQ(infos.size(), 4);
AssertFileInfo(infos[0], "AB/CD", FileType::Directory);
@@ -633,26 +633,26 @@ void GenericFileSystemTest::TestGetTargetInfosSelector(FileSystem* fs) {
// Check the mtime is the same from one call to the other
FileInfo info;
- ASSERT_OK_AND_ASSIGN(info, fs->GetTargetInfo("AB"));
+ ASSERT_OK_AND_ASSIGN(info, fs->GetFileInfo("AB"));
AssertFileInfo(info, "AB", FileType::Directory, first_dir_time);
- ASSERT_OK_AND_ASSIGN(info, fs->GetTargetInfo("AB/CD/ghi"));
+ ASSERT_OK_AND_ASSIGN(info, fs->GetFileInfo("AB/CD/ghi"));
AssertFileInfo(info, "AB/CD/ghi", FileType::File, first_file_time, 15);
// Doesn't exist
s.base_dir = "XX";
- ASSERT_RAISES(IOError, fs->GetTargetInfos(s));
+ ASSERT_RAISES(IOError, fs->GetFileInfo(s));
s.allow_not_found = true;
- ASSERT_OK_AND_ASSIGN(infos, fs->GetTargetInfos(s));
+ ASSERT_OK_AND_ASSIGN(infos, fs->GetFileInfo(s));
ASSERT_EQ(infos.size(), 0);
s.allow_not_found = false;
// Not a dir
s.base_dir = "abc";
- ASSERT_RAISES(IOError, fs->GetTargetInfos(s));
+ ASSERT_RAISES(IOError, fs->GetFileInfo(s));
}
void GetSortedInfos(FileSystem* fs, FileSelector s, std::vector<FileInfo>& infos) {
- ASSERT_OK_AND_ASSIGN(infos, fs->GetTargetInfos(s));
+ ASSERT_OK_AND_ASSIGN(infos, fs->GetFileInfo(s));
// Clear mtime & size for easier testing.
for_each(infos.begin(), infos.end(), [](FileInfo& info) {
info.set_mtime(kNoTime);
@@ -661,7 +661,7 @@ void GetSortedInfos(FileSystem* fs, FileSelector s, std::vector<FileInfo>& infos
SortInfos(&infos);
}
-void GenericFileSystemTest::TestGetTargetInfosSelectorWithRecursion(FileSystem* fs) {
+void GenericFileSystemTest::TestGetFileInfoSelectorWithRecursion(FileSystem* fs) {
ASSERT_OK(fs->CreateDir("01/02/03/04"));
ASSERT_OK(fs->CreateDir("AA"));
CreateFile(fs, "00.file", "00");
@@ -860,10 +860,10 @@ GENERIC_FS_TEST_DEFINE(TestDeleteFiles)
GENERIC_FS_TEST_DEFINE(TestMoveFile)
GENERIC_FS_TEST_DEFINE(TestMoveDir)
GENERIC_FS_TEST_DEFINE(TestCopyFile)
-GENERIC_FS_TEST_DEFINE(TestGetTargetInfo)
-GENERIC_FS_TEST_DEFINE(TestGetTargetInfosVector)
-GENERIC_FS_TEST_DEFINE(TestGetTargetInfosSelector)
-GENERIC_FS_TEST_DEFINE(TestGetTargetInfosSelectorWithRecursion)
+GENERIC_FS_TEST_DEFINE(TestGetFileInfo)
+GENERIC_FS_TEST_DEFINE(TestGetFileInfoVector)
+GENERIC_FS_TEST_DEFINE(TestGetFileInfoSelector)
+GENERIC_FS_TEST_DEFINE(TestGetFileInfoSelectorWithRecursion)
GENERIC_FS_TEST_DEFINE(TestOpenOutputStream)
GENERIC_FS_TEST_DEFINE(TestOpenAppendStream)
GENERIC_FS_TEST_DEFINE(TestOpenInputStream)
diff --git a/cpp/src/arrow/filesystem/test_util.h b/cpp/src/arrow/filesystem/test_util.h
index d3c0569..4134d7c 100644
--- a/cpp/src/arrow/filesystem/test_util.h
+++ b/cpp/src/arrow/filesystem/test_util.h
@@ -108,10 +108,10 @@ class ARROW_EXPORT GenericFileSystemTest {
void TestMoveFile();
void TestMoveDir();
void TestCopyFile();
- void TestGetTargetInfo();
- void TestGetTargetInfosVector();
- void TestGetTargetInfosSelector();
- void TestGetTargetInfosSelectorWithRecursion();
+ void TestGetFileInfo();
+ void TestGetFileInfoVector();
+ void TestGetFileInfoSelector();
+ void TestGetFileInfoSelectorWithRecursion();
void TestOpenOutputStream();
void TestOpenAppendStream();
void TestOpenInputStream();
@@ -146,10 +146,10 @@ class ARROW_EXPORT GenericFileSystemTest {
void TestMoveFile(FileSystem* fs);
void TestMoveDir(FileSystem* fs);
void TestCopyFile(FileSystem* fs);
- void TestGetTargetInfo(FileSystem* fs);
- void TestGetTargetInfosVector(FileSystem* fs);
- void TestGetTargetInfosSelector(FileSystem* fs);
- void TestGetTargetInfosSelectorWithRecursion(FileSystem* fs);
+ void TestGetFileInfo(FileSystem* fs);
+ void TestGetFileInfoVector(FileSystem* fs);
+ void TestGetFileInfoSelector(FileSystem* fs);
+ void TestGetFileInfoSelectorWithRecursion(FileSystem* fs);
void TestOpenOutputStream(FileSystem* fs);
void TestOpenAppendStream(FileSystem* fs);
void TestOpenInputStream(FileSystem* fs);
@@ -159,24 +159,24 @@ class ARROW_EXPORT GenericFileSystemTest {
#define GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, NAME) \
TEST_MACRO(TEST_CLASS, NAME) { this->Test##NAME(); }
-#define GENERIC_FS_TEST_FUNCTIONS_MACROS(TEST_MACRO, TEST_CLASS) \
- GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, Empty) \
- GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, NormalizePath) \
- GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, CreateDir) \
- GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, DeleteDir) \
- GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, DeleteDirContents) \
- GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, DeleteFile) \
- GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, DeleteFiles) \
- GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, MoveFile) \
- GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, MoveDir) \
- GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, CopyFile) \
- GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, GetTargetInfo) \
- GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, GetTargetInfosVector) \
- GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, GetTargetInfosSelector) \
- GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, GetTargetInfosSelectorWithRecursion) \
- GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, OpenOutputStream) \
- GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, OpenAppendStream) \
- GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, OpenInputStream) \
+#define GENERIC_FS_TEST_FUNCTIONS_MACROS(TEST_MACRO, TEST_CLASS) \
+ GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, Empty) \
+ GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, NormalizePath) \
+ GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, CreateDir) \
+ GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, DeleteDir) \
+ GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, DeleteDirContents) \
+ GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, DeleteFile) \
+ GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, DeleteFiles) \
+ GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, MoveFile) \
+ GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, MoveDir) \
+ GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, CopyFile) \
+ GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, GetFileInfo) \
+ GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, GetFileInfoVector) \
+ GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, GetFileInfoSelector) \
+ GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, GetFileInfoSelectorWithRecursion) \
+ GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, OpenOutputStream) \
+ GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, OpenAppendStream) \
+ GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, OpenInputStream) \
GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, OpenInputFile)
#define GENERIC_FS_TEST_FUNCTIONS(TEST_CLASS) \
diff --git a/python/pyarrow/_dataset.pyx b/python/pyarrow/_dataset.pyx
index 34791bb..bf5f134 100644
--- a/python/pyarrow/_dataset.pyx
+++ b/python/pyarrow/_dataset.pyx
@@ -293,7 +293,7 @@ cdef class FileSystemDataset(Dataset):
vector[shared_ptr[CExpression]] c_partitions
CResult[shared_ptr[CDataset]] result
- for info in filesystem.get_target_infos(paths_or_selector):
+ for info in filesystem.get_file_info(paths_or_selector):
c_file_infos.push_back(info.unwrap())
for expr in partitions:
diff --git a/python/pyarrow/_fs.pyx b/python/pyarrow/_fs.pyx
index 663997a..0697e26 100644
--- a/python/pyarrow/_fs.pyx
+++ b/python/pyarrow/_fs.pyx
@@ -61,7 +61,7 @@ cdef class FileInfo:
def __init__(self):
raise TypeError("FileInfo cannot be instantiated directly, use "
- "FileSystem.get_target_infos method instead.")
+ "FileSystem.get_file_info method instead.")
@staticmethod
cdef wrap(CFileInfo info):
@@ -269,8 +269,8 @@ cdef class FileSystem:
cdef inline shared_ptr[CFileSystem] unwrap(self) nogil:
return self.wrapped
- def get_target_infos(self, paths_or_selector):
- """Get infos for the given target.
+ def get_file_info(self, paths_or_selector):
+ """Get info for the given files.
Any symlink is automatically dereferenced, recursively. A non-existing
or unreachable file returns a FileStat object and has a FileType of
@@ -296,11 +296,11 @@ cdef class FileSystem:
if isinstance(paths_or_selector, FileSelector):
with nogil:
selector = (<FileSelector>paths_or_selector).selector
- infos = GetResultValue(self.fs.GetTargetInfos(selector))
+ infos = GetResultValue(self.fs.GetFileInfo(selector))
elif isinstance(paths_or_selector, (list, tuple)):
paths = [_path_as_bytes(s) for s in paths_or_selector]
with nogil:
- infos = GetResultValue(self.fs.GetTargetInfos(paths))
+ infos = GetResultValue(self.fs.GetFileInfo(paths))
else:
raise TypeError('Must pass either paths or a FileSelector')
diff --git a/python/pyarrow/dataset.py b/python/pyarrow/dataset.py
index 32edf6d..5e087ad 100644
--- a/python/pyarrow/dataset.py
+++ b/python/pyarrow/dataset.py
@@ -160,7 +160,7 @@ def _ensure_fs(filesystem, path):
# first check if the file exists as a local (relative) file path
filesystem = LocalFileSystem()
try:
- infos = filesystem.get_target_infos([path])[0]
+ infos = filesystem.get_file_info([path])[0]
except OSError:
return FileSystem.from_uri(path)
@@ -178,7 +178,7 @@ def _ensure_fs_and_paths(path, filesystem=None):
from pyarrow.fs import FileType, FileSelector
filesystem, path = _ensure_fs(filesystem, _stringify_path(path))
- infos = filesystem.get_target_infos([path])[0]
+ infos = filesystem.get_file_info([path])[0]
if infos.type == FileType.Directory:
# for directory, pass a selector
paths_or_selector = FileSelector(path, recursive=True)
diff --git a/python/pyarrow/includes/libarrow_fs.pxd b/python/pyarrow/includes/libarrow_fs.pxd
index f1f7ed6..a5a502f 100644
--- a/python/pyarrow/includes/libarrow_fs.pxd
+++ b/python/pyarrow/includes/libarrow_fs.pxd
@@ -61,10 +61,10 @@ cdef extern from "arrow/filesystem/api.h" namespace "arrow::fs" nogil:
cdef cppclass CFileSystem "arrow::fs::FileSystem":
c_string type_name() const
CResult[c_string] NormalizePath(c_string path)
- CResult[CFileInfo] GetTargetInfo(const c_string& path)
- CResult[vector[CFileInfo]] GetTargetInfos(
+ CResult[CFileInfo] GetFileInfo(const c_string& path)
+ CResult[vector[CFileInfo]] GetFileInfo(
const vector[c_string]& paths)
- CResult[vector[CFileInfo]] GetTargetInfos(const CFileSelector& select)
+ CResult[vector[CFileInfo]] GetFileInfo(const CFileSelector& select)
CStatus CreateDir(const c_string& path, c_bool recursive)
CStatus DeleteDir(const c_string& path)
CStatus DeleteFile(const c_string& path)
diff --git a/python/pyarrow/tests/test_fs.py b/python/pyarrow/tests/test_fs.py
index 14fa7ef..683b163 100644
--- a/python/pyarrow/tests/test_fs.py
+++ b/python/pyarrow/tests/test_fs.py
@@ -219,7 +219,7 @@ def test_get_target_infos(fs, pathfn):
fp.write(b'test')
aaa_info, bb_info, c_info, zzz_info = \
- fs.get_target_infos([aaa, bb, c, zzz])
+ fs.get_file_info([aaa, bb, c, zzz])
assert aaa_info.path == aaa
assert 'aaa' in repr(aaa_info)
@@ -269,7 +269,7 @@ def test_get_target_infos_with_selector(fs, pathfn):
recursive=True)
assert selector.base_dir == base_dir
- infos = fs.get_target_infos(selector)
+ infos = fs.get_file_info(selector)
assert len(infos) == 3
for info in infos:
@@ -582,7 +582,7 @@ def test_hdfs_options(hdfs_server):
host, port, user = hdfs_server
uri = "hdfs://{}:{}/?user={}".format(host, port, user)
fs = HadoopFileSystem(uri)
- assert fs.get_target_infos(FileSelector('/'))
+ assert fs.get_file_info(FileSelector('/'))
@pytest.mark.parametrize(('uri', 'expected_klass', 'expected_path'), [
@@ -633,6 +633,6 @@ def test_filesystem_from_uri_s3(minio_server):
assert path == "mybucket/foo/bar"
fs.create_dir(path)
- [info] = fs.get_target_infos([path])
+ [info] = fs.get_file_info([path])
assert info.path == path
assert info.type == FileType.Directory
diff --git a/r/DESCRIPTION b/r/DESCRIPTION
index 6de7ea8..7cbac09 100644
--- a/r/DESCRIPTION
+++ b/r/DESCRIPTION
@@ -37,7 +37,7 @@ Imports:
utils,
vctrs
Roxygen: list(markdown = TRUE, r6 = FALSE, load = "source")
-RoxygenNote: 7.0.2
+RoxygenNote: 7.1.0
VignetteBuilder: knitr
Suggests:
dplyr,
diff --git a/r/R/filesystem.R b/r/R/filesystem.R
index ef1c11e..079e64b 100644
--- a/r/R/filesystem.R
+++ b/r/R/filesystem.R
@@ -139,7 +139,7 @@ FileSelector$create <- function(base_dir, allow_not_found = FALSE, recursive = F
#'
#' @section Methods:
#'
-#' - `$GetTargetInfos(x)`: `x` may be a [FileSelector][FileSelector] or a character
+#' - `$GetFileInfo(x)`: `x` may be a [FileSelector][FileSelector] or a character
#' vector of paths. Returns a list of [FileInfo][FileInfo]
#' - `$CreateDir(path, recursive = TRUE)`: Create a directory and subdirectories.
#' - `$DeleteDir(path)`: Delete a directory and its contents, recursively.
@@ -175,7 +175,7 @@ FileSelector$create <- function(base_dir, allow_not_found = FALSE, recursive = F
#' @export
FileSystem <- R6Class("FileSystem", inherit = ArrowObject,
public = list(
- GetTargetInfos = function(x) {
+ GetFileInfo = function(x) {
if (inherits(x, "FileSelector")) {
map(
fs___FileSystem__GetTargetInfos_FileSelector(self, x),
@@ -189,7 +189,7 @@ FileSystem <- R6Class("FileSystem", inherit = ArrowObject,
class = FileInfo
)
} else {
- abort("incompatible type for FileSystem$GetTargetInfos()")
+ abort("incompatible type for FileSystem$GetFileInfo()")
}
},
diff --git a/r/man/FileSystem.Rd b/r/man/FileSystem.Rd
index 9fbe081..5b627f2 100644
--- a/r/man/FileSystem.Rd
+++ b/r/man/FileSystem.Rd
@@ -26,7 +26,7 @@ take the following arguments, depending on the subclass:
\section{Methods}{
\itemize{
-\item \verb{$GetTargetInfos(x)}: \code{x} may be a \link{FileSelector} or a character
+\item \verb{$GetFileInfo(x)}: \code{x} may be a \link{FileSelector} or a character
vector of paths. Returns a list of \link{FileInfo}
\item \verb{$CreateDir(path, recursive = TRUE)}: Create a directory and subdirectories.
\item \verb{$DeleteDir(path)}: Delete a directory and its contents, recursively.
diff --git a/r/man/enums.Rd b/r/man/enums.Rd
index 7f7358f..d8a7f4b 100644
--- a/r/man/enums.Rd
+++ b/r/man/enums.Rd
@@ -13,7 +13,25 @@
\alias{FileType}
\alias{ParquetVersionType}
\title{Arrow enums}
-\format{An object of class \code{TimeUnit::type} (inherits from \code{arrow-enum}) of length 4.}
+\format{
+An object of class \code{TimeUnit::type} (inherits from \code{arrow-enum}) of length 4.
+
+An object of class \code{DateUnit} (inherits from \code{arrow-enum}) of length 2.
+
+An object of class \code{Type::type} (inherits from \code{arrow-enum}) of length 28.
+
+An object of class \code{StatusCode} (inherits from \code{arrow-enum}) of length 17.
+
+An object of class \code{FileMode} (inherits from \code{arrow-enum}) of length 3.
+
+An object of class \code{Message::Type} (inherits from \code{arrow-enum}) of length 5.
+
+An object of class \code{Compression::type} (inherits from \code{arrow-enum}) of length 8.
+
+An object of class \code{FileType} (inherits from \code{arrow-enum}) of length 4.
+
+An object of class \code{ParquetVersionType} (inherits from \code{arrow-enum}) of length 2.
+}
\usage{
TimeUnit
diff --git a/r/man/write_parquet.Rd b/r/man/write_parquet.Rd
index d80b8f0..81ca28e 100644
--- a/r/man/write_parquet.Rd
+++ b/r/man/write_parquet.Rd
@@ -20,7 +20,8 @@ write_parquet(
use_deprecated_int96_timestamps = FALSE,
coerce_timestamps = NULL,
allow_truncated_timestamps = FALSE,
- arrow_properties = ParquetArrowWriterProperties$create(use_deprecated_int96_timestamps
+
+ arrow_properties = ParquetArrowWriterProperties$create(use_deprecated_int96_timestamps
= use_deprecated_int96_timestamps, coerce_timestamps = coerce_timestamps,
allow_truncated_timestamps = allow_truncated_timestamps)
)
diff --git a/r/src/filesystem.cpp b/r/src/filesystem.cpp
index 2cec6dd..b1e0d61 100644
--- a/r/src/filesystem.cpp
+++ b/r/src/filesystem.cpp
@@ -120,7 +120,7 @@ std::vector<std::shared_ptr<T>> shared_ptr_vector(const std::vector<T>& vec) {
std::vector<std::shared_ptr<fs::FileInfo>> fs___FileSystem__GetTargetInfos_Paths(
const std::shared_ptr<fs::FileSystem>& file_system,
const std::vector<std::string>& paths) {
- auto results = VALUE_OR_STOP(file_system->GetTargetInfos(paths));
+ auto results = VALUE_OR_STOP(file_system->GetFileInfo(paths));
return shared_ptr_vector(results);
}
@@ -128,7 +128,7 @@ std::vector<std::shared_ptr<fs::FileInfo>> fs___FileSystem__GetTargetInfos_Paths
std::vector<std::shared_ptr<fs::FileInfo>> fs___FileSystem__GetTargetInfos_FileSelector(
const std::shared_ptr<fs::FileSystem>& file_system,
const std::shared_ptr<fs::FileSelector>& selector) {
- auto results = VALUE_OR_STOP(file_system->GetTargetInfos(*selector));
+ auto results = VALUE_OR_STOP(file_system->GetFileInfo(*selector));
return shared_ptr_vector(results);
}
diff --git a/r/tests/testthat/test-filesystem.R b/r/tests/testthat/test-filesystem.R
index bf8bc40..8fddf7a 100644
--- a/r/tests/testthat/test-filesystem.R
+++ b/r/tests/testthat/test-filesystem.R
@@ -20,7 +20,7 @@ context("File system")
test_that("LocalFilesystem", {
fs <- LocalFileSystem$create()
DESCRIPTION <- system.file("DESCRIPTION", package = "arrow")
- info <- fs$GetTargetInfos(DESCRIPTION)[[1]]
+ info <- fs$GetFileInfo(DESCRIPTION)[[1]]
expect_equal(info$base_name(), "DESCRIPTION")
expect_equal(info$extension(), "")
expect_equal(info$type, FileType$File)
@@ -34,33 +34,33 @@ test_that("LocalFilesystem", {
tf <- tempfile(fileext = ".txt")
fs$CopyFile(DESCRIPTION, tf)
- info <- fs$GetTargetInfos(tf)[[1]]
+ info <- fs$GetFileInfo(tf)[[1]]
expect_equal(info$extension(), "txt")
expect_equal(info$size, info$size)
expect_equal(readLines(DESCRIPTION), readLines(tf))
tf2 <- tempfile(fileext = ".txt")
fs$Move(tf, tf2)
- infos <- fs$GetTargetInfos(c(tf, tf2, dirname(tf)))
+ infos <- fs$GetFileInfo(c(tf, tf2, dirname(tf)))
expect_equal(infos[[1]]$type, FileType$NotFound)
expect_equal(infos[[2]]$type, FileType$File)
expect_equal(infos[[3]]$type, FileType$Directory)
fs$DeleteFile(tf2)
- expect_equal(fs$GetTargetInfos(tf2)[[1L]]$type, FileType$NotFound)
+ expect_equal(fs$GetFileInfo(tf2)[[1L]]$type, FileType$NotFound)
expect_true(!file.exists(tf2))
- expect_equal(fs$GetTargetInfos(tf)[[1L]]$type, FileType$NotFound)
+ expect_equal(fs$GetFileInfo(tf)[[1L]]$type, FileType$NotFound)
expect_true(!file.exists(tf))
td <- tempfile()
fs$CreateDir(td)
- expect_equal(fs$GetTargetInfos(td)[[1L]]$type, FileType$Directory)
+ expect_equal(fs$GetFileInfo(td)[[1L]]$type, FileType$Directory)
fs$CopyFile(DESCRIPTION, file.path(td, "DESCRIPTION"))
fs$DeleteDirContents(td)
expect_equal(length(dir(td)), 0L)
fs$DeleteDir(td)
- expect_equal(fs$GetTargetInfos(td)[[1L]]$type, FileType$NotFound)
+ expect_equal(fs$GetFileInfo(td)[[1L]]$type, FileType$NotFound)
tf3 <- tempfile()
os <- fs$OpenOutputStream(path = tf3)
@@ -85,7 +85,7 @@ test_that("SubTreeFilesystem", {
expect_is(st_fs, "FileSystem")
st_fs$CreateDir("test")
st_fs$CopyFile("DESCRIPTION", "DESC.txt")
- infos <- st_fs$GetTargetInfos(c("DESCRIPTION", "test", "nope", "DESC.txt"))
+ infos <- st_fs$GetFileInfo(c("DESCRIPTION", "test", "nope", "DESC.txt"))
expect_equal(infos[[1L]]$type, FileType$File)
expect_equal(infos[[2L]]$type, FileType$Directory)
expect_equal(infos[[3L]]$type, FileType$NotFound)
@@ -93,7 +93,7 @@ test_that("SubTreeFilesystem", {
expect_equal(infos[[4L]]$extension(), "txt")
local_fs$DeleteDirContents(td)
- infos <- st_fs$GetTargetInfos(c("DESCRIPTION", "test", "nope", "DESC.txt"))
+ infos <- st_fs$GetFileInfo(c("DESCRIPTION", "test", "nope", "DESC.txt"))
expect_equal(infos[[1L]]$type, FileType$NotFound)
expect_equal(infos[[2L]]$type, FileType$NotFound)
expect_equal(infos[[3L]]$type, FileType$NotFound)
@@ -109,14 +109,14 @@ test_that("LocalFileSystem + Selector", {
writeLines("...", file.path(td, "dir", "three.txt"))
selector <- FileSelector$create(td, recursive = TRUE)
- infos <- fs$GetTargetInfos(selector)
+ infos <- fs$GetFileInfo(selector)
expect_equal(length(infos), 4L)
types <- sapply(infos, function(.x) .x$type)
expect_equal(sum(types == FileType$File), 3L)
expect_equal(sum(types == FileType$Directory), 1L)
selector <- FileSelector$create(td, recursive = FALSE)
- infos <- fs$GetTargetInfos(selector)
+ infos <- fs$GetFileInfo(selector)
expect_equal(length(infos), 3L)
types <- sapply(infos, function(.x) .x$type)
expect_equal(sum(types == FileType$File), 2L)