mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Another attempt.
This commit is contained in:
parent
89d80a4d65
commit
ec134d2642
@ -802,7 +802,7 @@ struct IdentifierResolveScope
|
||||
struct ResolvedFunctionsCache
|
||||
{
|
||||
FunctionOverloadResolverPtr resolver;
|
||||
std::map<IQueryTreeNode::Hash, FunctionBasePtr> cache;
|
||||
FunctionBasePtr function_base;
|
||||
};
|
||||
|
||||
std::map<IQueryTreeNode::Hash, ResolvedFunctionsCache> functions_cache;
|
||||
@ -931,24 +931,6 @@ struct IdentifierResolveScope
|
||||
}
|
||||
};
|
||||
|
||||
IQueryTreeNode::Hash getHashForFunctionArguments(const ColumnsWithTypeAndName & arguments)
|
||||
{
|
||||
SipHash hash;
|
||||
for (const auto & arg : arguments)
|
||||
{
|
||||
auto type_name = arg.type->getName();
|
||||
hash.update(type_name.c_str(), type_name.size());
|
||||
|
||||
if (arg.column)
|
||||
{
|
||||
if (const auto * col_const = typeid_cast<const ColumnConst *>(arg.column.get()))
|
||||
col_const->updateHashWithValue(0, hash);
|
||||
}
|
||||
}
|
||||
|
||||
return getSipHash128AsPair(hash);
|
||||
}
|
||||
|
||||
|
||||
/** Visitor that extracts expression and function aliases from node and initialize scope tables with it.
|
||||
* Does not go into child lambdas and queries.
|
||||
@ -5798,8 +5780,7 @@ ProjectionNames QueryAnalyzer::resolveFunction(QueryTreeNodePtr & node, Identifi
|
||||
FunctionBasePtr function_base;
|
||||
if (function_cache)
|
||||
{
|
||||
auto args_hash = getHashForFunctionArguments(argument_columns);
|
||||
auto & cached_function = function_cache->cache[args_hash];
|
||||
auto & cached_function = function_cache->function_base;
|
||||
if (!cached_function)
|
||||
cached_function = function->build(argument_columns);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user