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

Function parseMapNameFromImplicitFileName

src/DataTypes/MapHelpers.cpp:201–219  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

199}
200
201String parseMapNameFromImplicitFileName(const String & implicit_file_name)
202{
203 String unescape_file_name = unescapeForFileName(implicit_file_name);
204 if (!startsWith(unescape_file_name, getMapSeparator()))
205 throw Exception(ErrorCodes::INVALID_IMPLICIT_COLUMN_NAME, "Invalid implicit file name: {}", implicit_file_name);
206
207 /// Base file need to use implicit file name instead of unescape_file_name
208 auto location_base = implicit_file_name.find("_base.", getMapSeparator().size());
209 if (location_base == String::npos)
210 {
211 /// Due to map column name meets the constraint in MergeTreeMetaBase::checkColumnsValidity, so we can find second separator directly.
212 auto location = unescape_file_name.find(getMapSeparator(), getMapSeparator().size());
213 if (location == String::npos)
214 throw Exception(ErrorCodes::INVALID_IMPLICIT_COLUMN_NAME, "Invalid implicit column name: {}", implicit_file_name);
215 return unescape_file_name.substr(getMapSeparator().size(), location - getMapSeparator().size());
216 }
217 else
218 return unescapeForFileName(implicit_file_name.substr(getMapSeparator().size(), location_base - getMapSeparator().size()));
219}
220
221String parseKeyNameFromImplicitFileName(const String & implicit_file_name, const String & map_col)
222{

Callers 3

isArraySetCheckMethod · 0.85
extractMapColumnKeysFunction · 0.85

Calls 5

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

Tested by

no test coverage detected