MCPcopy Create free account
hub / github.com/apache/impala / GetFilesystemNameLength

Function GetFilesystemNameLength

be/src/util/hdfs-util.cc:152–164  ·  view source on GitHub ↗

Returns the length of the filesystem name in 'path' which is the length of the 'scheme://authority'. Returns 0 if the path is unqualified.

Source from the content-addressed store, hash-verified

150// Returns the length of the filesystem name in 'path' which is the length of the
151// 'scheme://authority'. Returns 0 if the path is unqualified.
152static int GetFilesystemNameLength(const char* path) {
153 // Special case for "file:/". It will not have an authority following it.
154 if (strncmp(path, "file:", 5) == 0) return 5;
155
156 const char* after_scheme = strstr(path, "://");
157 if (after_scheme == NULL) return 0;
158 // Some paths may come only with a scheme. We add 3 to skip over "://".
159 if (*(after_scheme + 3) == '\0') return strlen(path);
160
161 const char* after_authority = strstr(after_scheme + 3, "/");
162 if (after_authority == NULL) return strlen(path);
163 return after_authority - path;
164}
165
166static bool FilesystemsMatch(const char* path_a, const char* path_b) {
167 int fs_a_name_length = GetFilesystemNameLength(path_a);

Callers 3

FilesystemsMatchFunction · 0.85
OfsBucketsMatchFunction · 0.85
GetBaseNameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected