| 894 | namespace { |
| 895 | |
| 896 | Result<std::shared_ptr<FileSystem>> FileSystemFromUriReal( |
| 897 | const Uri& uri, const std::string& uri_string, |
| 898 | const FileSystemFactoryOptions& options, const io::IOContext& io_context, |
| 899 | std::string* out_path) { |
| 900 | const auto scheme = uri.scheme(); |
| 901 | |
| 902 | { |
| 903 | ARROW_ASSIGN_OR_RAISE( |
| 904 | auto* factory, |
| 905 | FileSystemFactoryRegistry::GetInstance()->FactoryForScheme(scheme)); |
| 906 | if (factory != nullptr) { |
| 907 | return factory->function(uri, options, io_context, out_path); |
| 908 | } |
| 909 | } |
| 910 | if (!options.empty()) { |
| 911 | return Status::NotImplemented("Filesystem options are not supported yet for scheme '", |
| 912 | scheme, "', got ", options.size(), " option(s)"); |
| 913 | } |
| 914 | |
| 915 | if (scheme == "abfs" || scheme == "abfss") { |
| 916 | #ifdef ARROW_AZURE |
| 917 | ARROW_ASSIGN_OR_RAISE(auto options, AzureOptions::FromUri(uri, out_path)); |
| 918 | return AzureFileSystem::Make(options, io_context); |
| 919 | #else |
| 920 | return Status::NotImplemented( |
| 921 | "Got Azure Blob File System URI but Arrow compiled without Azure Blob File " |
| 922 | "System support"); |
| 923 | #endif |
| 924 | } |
| 925 | if (scheme == "gs" || scheme == "gcs") { |
| 926 | #ifdef ARROW_GCS |
| 927 | ARROW_ASSIGN_OR_RAISE(auto options, GcsOptions::FromUri(uri, out_path)); |
| 928 | return GcsFileSystem::Make(options, io_context); |
| 929 | #else |
| 930 | return Status::NotImplemented( |
| 931 | "Got GCS URI but Arrow compiled " |
| 932 | "without GCS support"); |
| 933 | #endif |
| 934 | } |
| 935 | if (scheme == "hdfs" || scheme == "viewfs") { |
| 936 | #ifdef ARROW_HDFS |
| 937 | ARROW_ASSIGN_OR_RAISE(auto options, HdfsOptions::FromUri(uri)); |
| 938 | if (out_path != nullptr) { |
| 939 | *out_path = uri.path(); |
| 940 | } |
| 941 | ARROW_ASSIGN_OR_RAISE(auto hdfs, HadoopFileSystem::Make(options, io_context)); |
| 942 | return hdfs; |
| 943 | #else |
| 944 | return Status::NotImplemented( |
| 945 | "Got HDFS URI but Arrow compiled " |
| 946 | "without HDFS support"); |
| 947 | #endif |
| 948 | } |
| 949 | |
| 950 | if (scheme == "mock") { |
| 951 | // MockFileSystem does not have an |
| 952 | // absolute / relative path distinction, |
| 953 | // normalize path by removing leading |
no test coverage detected