mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 08:02:02 +00:00
Merge pull request #41842 from amosbird/index_analysis_1
This commit is contained in:
commit
3f24c904ad
@ -1640,6 +1640,13 @@ bool KeyCondition::tryParseAtomFromAST(const Tree & node, ContextPtr context, Bl
|
||||
}
|
||||
else if (func.getArgumentAt(1).tryGetConstant(block_with_constants, const_value, const_type))
|
||||
{
|
||||
/// If the const operand is null, the atom will be always false
|
||||
if (const_value.isNull())
|
||||
{
|
||||
out.function = RPNElement::ALWAYS_FALSE;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isKeyPossiblyWrappedByMonotonicFunctions(func.getArgumentAt(0), context, key_column_num, key_expr_type, chain))
|
||||
{
|
||||
key_arg_pos = 0;
|
||||
@ -1663,6 +1670,13 @@ bool KeyCondition::tryParseAtomFromAST(const Tree & node, ContextPtr context, Bl
|
||||
}
|
||||
else if (func.getArgumentAt(0).tryGetConstant(block_with_constants, const_value, const_type))
|
||||
{
|
||||
/// If the const operand is null, the atom will be always false
|
||||
if (const_value.isNull())
|
||||
{
|
||||
out.function = RPNElement::ALWAYS_FALSE;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isKeyPossiblyWrappedByMonotonicFunctions(func.getArgumentAt(1), context, key_column_num, key_expr_type, chain))
|
||||
{
|
||||
key_arg_pos = 1;
|
||||
|
@ -3,5 +3,4 @@
|
||||
2020-10-24 00:00:00 1.3619605237696326 0.16794469697335793 0.7637956767025532 0.8899329799574005 0.6227685185389797 0.30795997278638165 0.7637956767025532
|
||||
2020-10-24 00:00:00 19 -1.9455094931672063 0.7759802460082872 0.6 0
|
||||
2020-10-24 00:00:00 852 894
|
||||
2 -1
|
||||
999
|
||||
|
@ -0,0 +1,2 @@
|
||||
0
|
||||
0
|
@ -0,0 +1,21 @@
|
||||
-- From https://github.com/ClickHouse/ClickHouse/issues/41814
|
||||
drop table if exists test;
|
||||
|
||||
create table test(a UInt64, m UInt64, d DateTime) engine MergeTree partition by toYYYYMM(d) order by (a, m, d);
|
||||
|
||||
insert into test select number, number, '2022-01-01 00:00:00' from numbers(1000000);
|
||||
|
||||
select count() from test where a = (select toUInt64(1) where 1 = 2) settings enable_early_constant_folding = 0, force_primary_key = 1;
|
||||
|
||||
drop table test;
|
||||
|
||||
-- From https://github.com/ClickHouse/ClickHouse/issues/34063
|
||||
drop table if exists test_null_filter;
|
||||
|
||||
create table test_null_filter(key UInt64, value UInt32) engine MergeTree order by key;
|
||||
|
||||
insert into test_null_filter select number, number from numbers(10000000);
|
||||
|
||||
select count() from test_null_filter where key = null and value > 0 settings force_primary_key = 1;
|
||||
|
||||
drop table test_null_filter;
|
Loading…
Reference in New Issue
Block a user