From ac3d0f99f2259cb5450b94757387c5a2afb6a46f Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Wed, 20 Apr 2022 16:14:36 +0900 Subject: [PATCH] ARROW-16248: [C++][FS] Add GCS support to FileSystemFromUri() --- cpp/src/arrow/filesystem/filesystem.cc | 3 +-- cpp/src/arrow/filesystem/filesystem.h | 6 ++++-- cpp/src/arrow/util/config.h.cmake | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cpp/src/arrow/filesystem/filesystem.cc b/cpp/src/arrow/filesystem/filesystem.cc index 19d122b571e..68a33cec967 100644 --- a/cpp/src/arrow/filesystem/filesystem.cc +++ b/cpp/src/arrow/filesystem/filesystem.cc @@ -692,8 +692,7 @@ Result> FileSystemFromUriReal(const Uri& uri, if (scheme == "gs" || scheme == "gcs") { #ifdef ARROW_GCS ARROW_ASSIGN_OR_RAISE(auto options, GcsOptions::FromUri(uri, out_path)); - ARROW_ASSIGN_OR_RAISE(auto gcsfs, GcsFileSystem::Make(options, io_context)); - return gcsfs; + return GcsFileSystem::Make(options, io_context); #else return Status::NotImplemented("Got GCS URI but Arrow compiled without GCS support"); #endif diff --git a/cpp/src/arrow/filesystem/filesystem.h b/cpp/src/arrow/filesystem/filesystem.h index f74eaf98c3c..64af7222539 100644 --- a/cpp/src/arrow/filesystem/filesystem.h +++ b/cpp/src/arrow/filesystem/filesystem.h @@ -450,7 +450,8 @@ class ARROW_EXPORT SlowFileSystem : public FileSystem { /// \brief Create a new FileSystem by URI /// -/// Recognized schemes are "file", "mock", "hdfs" and "s3fs". +/// Recognized schemes are "file", "mock", "hdfs", "viewfs", "s3", +/// "gs" and "gcs". /// /// \param[in] uri a URI-based path, ex: file:///some/local/path /// \param[out] out_path (optional) Path inside the filesystem. @@ -461,7 +462,8 @@ Result> FileSystemFromUri(const std::string& uri, /// \brief Create a new FileSystem by URI with a custom IO context /// -/// Recognized schemes are "file", "mock", "hdfs" and "s3fs". +/// Recognized schemes are "file", "mock", "hdfs", "viewfs", "s3", +/// "gs" and "gcs". /// /// \param[in] uri a URI-based path, ex: file:///some/local/path /// \param[in] io_context an IOContext which will be associated with the filesystem diff --git a/cpp/src/arrow/util/config.h.cmake b/cpp/src/arrow/util/config.h.cmake index 55bc2d01005..bd6447a20e0 100644 --- a/cpp/src/arrow/util/config.h.cmake +++ b/cpp/src/arrow/util/config.h.cmake @@ -45,6 +45,7 @@ #cmakedefine ARROW_IPC #cmakedefine ARROW_JSON +#cmakedefine ARROW_GCS #cmakedefine ARROW_S3 #cmakedefine ARROW_USE_NATIVE_INT128 #cmakedefine ARROW_WITH_OPENTELEMETRY