mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
Merge pull request #65110 from ClickHouse/analyzer-fix-agg-name-rewriting
Analyzer: Fix aggregate function name rewriting
This commit is contained in:
commit
2d051f20b0
@ -985,15 +985,15 @@ std::string QueryAnalyzer::rewriteAggregateFunctionNameIfNeeded(
|
|||||||
{
|
{
|
||||||
result_aggregate_function_name = settings.count_distinct_implementation;
|
result_aggregate_function_name = settings.count_distinct_implementation;
|
||||||
}
|
}
|
||||||
else if (aggregate_function_name_lowercase == "countdistinctif" || aggregate_function_name_lowercase == "countifdistinct")
|
else if (aggregate_function_name_lowercase == "countifdistinct" ||
|
||||||
|
(settings.rewrite_count_distinct_if_with_count_distinct_implementation && aggregate_function_name_lowercase == "countdistinctif"))
|
||||||
{
|
{
|
||||||
result_aggregate_function_name = settings.count_distinct_implementation;
|
result_aggregate_function_name = settings.count_distinct_implementation;
|
||||||
result_aggregate_function_name += "If";
|
result_aggregate_function_name += "If";
|
||||||
}
|
}
|
||||||
|
else if (aggregate_function_name_lowercase.ends_with("ifdistinct"))
|
||||||
/// Replace aggregateFunctionIfDistinct into aggregateFunctionDistinctIf to make execution more optimal
|
|
||||||
if (result_aggregate_function_name.ends_with("ifdistinct"))
|
|
||||||
{
|
{
|
||||||
|
/// Replace aggregateFunctionIfDistinct into aggregateFunctionDistinctIf to make execution more optimal
|
||||||
size_t prefix_length = result_aggregate_function_name.size() - strlen("ifdistinct");
|
size_t prefix_length = result_aggregate_function_name.size() - strlen("ifdistinct");
|
||||||
result_aggregate_function_name = result_aggregate_function_name.substr(0, prefix_length) + "DistinctIf";
|
result_aggregate_function_name = result_aggregate_function_name.substr(0, prefix_length) + "DistinctIf";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user