mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 16:42:05 +00:00
improve least/greatest by allow nullable numberic fields compare
This commit is contained in:
parent
0f23f9b384
commit
2a14168075
@ -111,7 +111,7 @@ public:
|
|||||||
argument_types.push_back(argument.type);
|
argument_types.push_back(argument.type);
|
||||||
|
|
||||||
/// More efficient specialization for two numeric arguments.
|
/// More efficient specialization for two numeric arguments.
|
||||||
if (arguments.size() == 2 && isNumber(arguments[0].type) && isNumber(arguments[1].type))
|
if (arguments.size() == 2 && isNumber(removeNullable(arguments[0].type)) && isNumber(removeNullable(arguments[1].type)))
|
||||||
return std::make_unique<FunctionToFunctionBaseAdaptor>(SpecializedFunction::create(context), argument_types, return_type);
|
return std::make_unique<FunctionToFunctionBaseAdaptor>(SpecializedFunction::create(context), argument_types, return_type);
|
||||||
|
|
||||||
return std::make_unique<FunctionToFunctionBaseAdaptor>(
|
return std::make_unique<FunctionToFunctionBaseAdaptor>(
|
||||||
|
10
tests/performance/least_greatest.xml
Normal file
10
tests/performance/least_greatest.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<test>
|
||||||
|
<create_query>CREATE TABLE test (id Int32, x1 Nullable(Int32), x2 Nullable(Float32)) ENGINE = MergeTree() ORDER BY id</create_query>
|
||||||
|
|
||||||
|
<fill_query>INSERT INTO test SELECT number, number+1, number + 2 FROM numbers(1000000)</fill_query>
|
||||||
|
|
||||||
|
<query tag='LEAST'>SELECT COUNT(1) FROM test WHERE least(x1, x2) > 1</query>
|
||||||
|
<query tag='GREATEST'>SELECT COUNT(1) FROM test WHERE GREATEST(x1, x2) > 1</query>
|
||||||
|
|
||||||
|
<drop_query>DROP TABLE IF EXISTS test</drop_query>
|
||||||
|
</test>
|
Loading…
Reference in New Issue
Block a user