MCPcopy Create free account
hub / github.com/apache/arrow / FileSystemFromUriReal

Function FileSystemFromUriReal

cpp/src/arrow/filesystem/filesystem.cc:896–963  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

894namespace {
895
896Result<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

Callers 1

Calls 12

RemoveLeadingSlashFunction · 0.85
FactoryForSchemeMethod · 0.80
CurrentTimePointFunction · 0.70
ARROW_ASSIGN_OR_RAISEFunction · 0.50
NotImplementedFunction · 0.50
MakeFunction · 0.50
InvalidFunction · 0.50
schemeMethod · 0.45
functionMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45
pathMethod · 0.45

Tested by

no test coverage detected