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

Fix logical error in functions greatest/least #29454

Merged
merged 1 commit into from Sep 28, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Functions/LeastGreatestGeneric.h
Expand Up @@ -107,6 +107,8 @@ class LeastGreatestOverloadResolver : public IFunctionOverloadResolver
FunctionBasePtr buildImpl(const ColumnsWithTypeAndName & arguments, const DataTypePtr & return_type) const override
{
DataTypes argument_types;
for (const auto & argument : arguments)
argument_types.push_back(argument.type);

/// More efficient specialization for two numeric arguments.
if (arguments.size() == 2 && isNumber(arguments[0].type) && isNumber(arguments[1].type))
Expand Down
1 change: 1 addition & 0 deletions tests/queries/0_stateless/01822_short_circuit.sql
Expand Up @@ -153,3 +153,4 @@ select number % 2 and toLowCardinality(number) from numbers(5);
select number % 2 or toLowCardinality(number) from numbers(5);
select if(toLowCardinality(number) % 2, number, number + 1) from numbers(10);
select multiIf(toLowCardinality(number) % 2, number, number + 1) from numbers(10);

@@ -0,0 +1,20 @@
0
1
1
1
1
1
0
1
1
1
0
1
0
0
0
1
0
1
0
0
@@ -0,0 +1,2 @@
select 1 and greatest(number % 2, number % 3) from numbers(10);
select 1 and least(number % 2, number % 3) from numbers(10);