Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport #62066 to 24.3: Fix type for ConvertInToEqualPass #62097

Merged
merged 1 commit into from
Mar 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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]);
Loading