mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 17:12:03 +00:00
Merge pull request #64638 from ClickHouse/analyzer-fix-rewrite-agg-with-if
Analyzer: Fix RewriteAggregateFunctionWithIfPass
This commit is contained in:
commit
dc2d5e0ec6
@ -36,6 +36,10 @@ public:
|
|||||||
if (!function_node || !function_node->isAggregateFunction())
|
if (!function_node || !function_node->isAggregateFunction())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
auto lower_name = Poco::toLower(function_node->getFunctionName());
|
||||||
|
if (lower_name.ends_with("if"))
|
||||||
|
return;
|
||||||
|
|
||||||
auto & function_arguments_nodes = function_node->getArguments().getNodes();
|
auto & function_arguments_nodes = function_node->getArguments().getNodes();
|
||||||
if (function_arguments_nodes.size() != 1)
|
if (function_arguments_nodes.size() != 1)
|
||||||
return;
|
return;
|
||||||
@ -44,7 +48,6 @@ public:
|
|||||||
if (!if_node || if_node->getFunctionName() != "if")
|
if (!if_node || if_node->getFunctionName() != "if")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto lower_name = Poco::toLower(function_node->getFunctionName());
|
|
||||||
auto if_arguments_nodes = if_node->getArguments().getNodes();
|
auto if_arguments_nodes = if_node->getArguments().getNodes();
|
||||||
auto * first_const_node = if_arguments_nodes[1]->as<ConstantNode>();
|
auto * first_const_node = if_arguments_nodes[1]->as<ConstantNode>();
|
||||||
auto * second_const_node = if_arguments_nodes[2]->as<ConstantNode>();
|
auto * second_const_node = if_arguments_nodes[2]->as<ConstantNode>();
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
1
|
@ -0,0 +1 @@
|
|||||||
|
SELECT countIf(multiIf(number < 2, NULL, if(number = 4, 1, 0))) FROM numbers(5);
|
Loading…
Reference in New Issue
Block a user