MCPcopy Create free account
hub / github.com/ByConity/ByConity / parseKeyNameFromImplicitFileName

Function parseKeyNameFromImplicitFileName

src/DataTypes/MapHelpers.cpp:221–234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

219}
220
221String parseKeyNameFromImplicitFileName(const String & implicit_file_name, const String & map_col)
222{
223 String prefix = getMapKeyPrefix(map_col);
224 String unescape_file_name = unescapeForFileName(implicit_file_name);
225 if (!startsWith(unescape_file_name, prefix))
226 throw Exception(ErrorCodes::INVALID_IMPLICIT_COLUMN_FILE_NAME, "Implicit file name {} is not belong to map column {} ", implicit_file_name, map_col);
227
228 auto extension_loc = implicit_file_name.find('.'); /// only extension contain dot, other dots in column name are escaped.
229 if (extension_loc == String::npos)
230 throw Exception(ErrorCodes::INVALID_IMPLICIT_COLUMN_FILE_NAME, "Invalid file name of implicit column: {]", implicit_file_name);
231 size_t extension_size = implicit_file_name.size() - extension_loc;
232
233 return unescape_file_name.substr(prefix.size(), unescape_file_name.size() - prefix.size() - extension_size);
234}
235
236String parseMapNameFromImplicitColName(const String & implicit_column_name)
237{

Calls 6

getMapKeyPrefixFunction · 0.85
unescapeForFileNameFunction · 0.85
startsWithFunction · 0.50
ExceptionClass · 0.50
findMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected