diff --git a/dbms/include/DB/Functions/FunctionsURL.h b/dbms/include/DB/Functions/FunctionsURL.h index ead631304e1..357b5d904a8 100644 --- a/dbms/include/DB/Functions/FunctionsURL.h +++ b/dbms/include/DB/Functions/FunctionsURL.h @@ -265,6 +265,27 @@ struct ExtractPath } }; +struct ExtractPathFull +{ + static size_t getReserveLengthForElement() { return 30; } + + static void execute(const Pos data, const size_t size, Pos & res_data, size_t & res_size) + { + res_data = data; + res_size = 0; + + Pos pos = data; + Pos end = pos + size; + + if (nullptr != (pos = strchr(data, '/')) && pos[1] == '/' && nullptr != (pos = strchr(pos + 2, '/'))) + { + /// no leading slash + res_data = pos + 1; + res_size = end - res_data; + } + } +}; + template struct ExtractQueryString { @@ -941,6 +962,7 @@ struct NameDomainWithoutWWW { static constexpr auto name = "domainWithoutWWW" struct NameFirstSignificantSubdomain { static constexpr auto name = "firstSignificantSubdomain"; }; struct NameTopLevelDomain { static constexpr auto name = "topLevelDomain"; }; struct NamePath { static constexpr auto name = "path"; }; +struct NamePathFull { static constexpr auto name = "pathFull"; }; struct NameQueryString { static constexpr auto name = "queryString"; }; struct NameFragment { static constexpr auto name = "fragment"; }; struct NameQueryStringAndFragment { static constexpr auto name = "queryStringAndFragment"; }; @@ -961,6 +983,7 @@ typedef FunctionStringToString >, Na typedef FunctionStringToString, NameFirstSignificantSubdomain> FunctionFirstSignificantSubdomain; typedef FunctionStringToString, NameTopLevelDomain> FunctionTopLevelDomain; typedef FunctionStringToString, NamePath> FunctionPath; +typedef FunctionStringToString, NamePathFull> FunctionPathFull; typedef FunctionStringToString >, NameQueryString> FunctionQueryString; typedef FunctionStringToString >, NameFragment> FunctionFragment; typedef FunctionStringToString >, NameQueryStringAndFragment> FunctionQueryStringAndFragment; diff --git a/dbms/src/Functions/FunctionsURL.cpp b/dbms/src/Functions/FunctionsURL.cpp index 67cdd59784a..abb640256c3 100644 --- a/dbms/src/Functions/FunctionsURL.cpp +++ b/dbms/src/Functions/FunctionsURL.cpp @@ -12,6 +12,7 @@ void registerFunctionsURL(FunctionFactory & factory) factory.registerFunction(); factory.registerFunction(); factory.registerFunction(); + factory.registerFunction(); factory.registerFunction(); factory.registerFunction(); factory.registerFunction();