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

Method FromString

cpp/src/arrow/filesystem/azurefs.cc:498–523  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

496 std::vector<std::string> path_parts;
497
498 static Result<AzureLocation> FromString(const std::string& string) {
499 // Example expected string format: testcontainer/testdir/testfile.txt
500 // container = testcontainer
501 // path = testdir/testfile.txt
502 // path_parts = [testdir, testfile.txt]
503 if (internal::IsLikelyUri(string)) {
504 return Status::Invalid(
505 "Expected an Azure object location of the form 'container/path...',"
506 " got a URI: '",
507 string, "'");
508 }
509 auto first_sep = string.find_first_of(internal::kSep);
510 if (first_sep == 0) {
511 return Status::Invalid("Location cannot start with a separator ('", string, "')");
512 }
513 if (first_sep == std::string::npos) {
514 return AzureLocation{string, string, "", {}};
515 }
516 AzureLocation location;
517 location.all = string;
518 location.container = string.substr(0, first_sep);
519 location.path = string.substr(first_sep + 1);
520 location.path_parts = internal::SplitAbstractPath(location.path);
521 RETURN_NOT_OK(location.Validate());
522 return location;
523 }
524
525 AzureLocation parent() const {
526 DCHECK(has_parent());

Callers

nothing calls this directly

Calls 5

IsLikelyUriFunction · 0.85
SplitAbstractPathFunction · 0.85
substrMethod · 0.80
InvalidFunction · 0.50
ValidateMethod · 0.45

Tested by

no test coverage detected