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

Function FileSystemFromUriReal

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

Source from the content-addressed store, hash-verified

894namespace {
895
896Result<std::shared_ptr<FileSystem>> FileSystemFromUriReal(const Uri& uri,
897 const std::string& uri_string,
898 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, io_context, out_path);
908 }
909 }
910
911 if (scheme == "abfs" || scheme == "abfss") {
912#ifdef ARROW_AZURE
913 ARROW_ASSIGN_OR_RAISE(auto options, AzureOptions::FromUri(uri, out_path));
914 return AzureFileSystem::Make(options, io_context);
915#else
916 return Status::NotImplemented(
917 "Got Azure Blob File System URI but Arrow compiled without Azure Blob File "
918 "System support");
919#endif
920 }
921 if (scheme == "gs" || scheme == "gcs") {
922#ifdef ARROW_GCS
923 ARROW_ASSIGN_OR_RAISE(auto options, GcsOptions::FromUri(uri, out_path));
924 return GcsFileSystem::Make(options, io_context);
925#else
926 return Status::NotImplemented(
927 "Got GCS URI but Arrow compiled "
928 "without GCS support");
929#endif
930 }
931 if (scheme == "hdfs" || scheme == "viewfs") {
932#ifdef ARROW_HDFS
933 ARROW_ASSIGN_OR_RAISE(auto options, HdfsOptions::FromUri(uri));
934 if (out_path != nullptr) {
935 *out_path = uri.path();
936 }
937 ARROW_ASSIGN_OR_RAISE(auto hdfs, HadoopFileSystem::Make(options, io_context));
938 return hdfs;
939#else
940 return Status::NotImplemented(
941 "Got HDFS URI but Arrow compiled "
942 "without HDFS support");
943#endif
944 }
945
946 if (scheme == "mock") {
947 // MockFileSystem does not have an
948 // absolute / relative path distinction,
949 // normalize path by removing leading
950 // slash.
951 if (out_path != nullptr) {
952 *out_path = std::string(RemoveLeadingSlash(uri.path()));
953 }

Callers 1

FileSystemFromUriFunction · 0.85

Calls 10

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

Tested by

no test coverage detected