Skip to content

Commit

Permalink
Merge pull request #62097 from ClickHouse/backport/24.3/62066
Browse files Browse the repository at this point in the history
Backport #62066 to 24.3: Fix type for ConvertInToEqualPass
  • Loading branch information
alexey-milovidov committed Mar 30, 2024
2 parents a32c121 + f08e56b commit 50512ec
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Analyzer/Passes/ConvertInToEqualPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ class ConvertInToEqualPassVisitor : public InDepthQueryTreeVisitorWithContext<Co
return ;
auto result_func_name = MAPPING.at(func_node->getFunctionName());
auto equal = std::make_shared<FunctionNode>(result_func_name);
QueryTreeNodes arguments{column_node->clone(), constant_node->clone()};
auto new_const = std::make_shared<ConstantNode>(constant_node->getValue(), removeNullable(constant_node->getResultType()));
new_const->getSourceExpression() = constant_node->getSourceExpression();
QueryTreeNodes arguments{column_node->clone(), new_const};
equal->getArguments().getNodes() = std::move(arguments);
FunctionOverloadResolverPtr resolver;
bool decimal_check_overflow = getContext()->getSettingsRef().decimal_check_overflow;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,4 @@ QUERY id: 0
LIST id: 6, nodes: 2
COLUMN id: 7, column_name: x, result_type: String, source_id: 3
CONSTANT id: 8, constant_value: NULL, constant_value_type: Nullable(Nothing)
-------------------
3 changes: 3 additions & 0 deletions tests/queries/0_stateless/03013_optimize_in_to_equal.sql
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ select '-------------------';
explain query tree select * from test where x not in (NULL);
select '-------------------';
explain query tree select * from test where x in (NULL);
select '-------------------';
--- fuzzed
SELECT number FROM numbers(2) WHERE arrayExists(_ -> (_ IN toNullable(4294967290)), [number]);

0 comments on commit 50512ec

Please sign in to comment.