mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
ActionsDAG: do not change result of and() during optimization - part 2 (#47028)
This commit is contained in:
parent
3cd88003dd
commit
81b30021db
@ -1946,7 +1946,7 @@ ActionsDAGPtr ActionsDAG::cloneActionsForFilterPushDown(
|
||||
}
|
||||
|
||||
auto conjunction = getConjunctionNodes(predicate, allowed_nodes);
|
||||
if (conjunction.rejected.size() == 1 && WhichDataType{conjunction.rejected.front()->result_type}.isFloat())
|
||||
if (conjunction.rejected.size() == 1 && WhichDataType{removeNullable(conjunction.rejected.front()->result_type)}.isFloat())
|
||||
return nullptr;
|
||||
|
||||
auto actions = cloneActionsForConjunction(conjunction.allowed, all_inputs);
|
||||
@ -2014,7 +2014,7 @@ ActionsDAGPtr ActionsDAG::cloneActionsForFilterPushDown(
|
||||
node.children.swap(new_children);
|
||||
*predicate = std::move(node);
|
||||
}
|
||||
else if (!WhichDataType{new_children.front()->result_type}.isFloat())
|
||||
else if (!WhichDataType{removeNullable(new_children.front()->result_type)}.isFloat())
|
||||
{
|
||||
/// If type is different, cast column.
|
||||
/// This case is possible, cause AND can use any numeric type as argument.
|
||||
@ -2045,7 +2045,7 @@ ActionsDAGPtr ActionsDAG::cloneActionsForFilterPushDown(
|
||||
/// remove the AND.
|
||||
/// Just update children and rebuild it.
|
||||
predicate->children.swap(new_children);
|
||||
if (WhichDataType{predicate->children.front()->result_type}.isFloat())
|
||||
if (WhichDataType{removeNullable(predicate->children.front()->result_type)}.isFloat())
|
||||
{
|
||||
Node node;
|
||||
node.type = ActionType::COLUMN;
|
||||
|
@ -0,0 +1,4 @@
|
||||
10
|
||||
#45218
|
||||
10
|
||||
=
|
21
tests/queries/0_stateless/02674_and_consistency.sql
Normal file
21
tests/queries/0_stateless/02674_and_consistency.sql
Normal file
@ -0,0 +1,21 @@
|
||||
SELECT SUM(number)
|
||||
FROM
|
||||
(
|
||||
SELECT 10 AS number
|
||||
)
|
||||
GROUP BY number
|
||||
HAVING 1 AND sin(SUMOrNull(number))
|
||||
SETTINGS enable_optimize_predicate_expression = 0;
|
||||
|
||||
select '#45218';
|
||||
|
||||
SELECT SUM(number)
|
||||
FROM
|
||||
(
|
||||
SELECT 10 AS number
|
||||
)
|
||||
GROUP BY cos(min2(number, number) % number) - number
|
||||
HAVING ((-sign(-233841197)) IS NOT NULL) AND sin(lcm(SUM(number), SUM(number)) >= ('372497213' IS NOT NULL))
|
||||
SETTINGS aggregate_functions_null_for_empty = 1, enable_optimize_predicate_expression = 0;
|
||||
|
||||
select '=';
|
Loading…
Reference in New Issue
Block a user