mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 10:02:01 +00:00
Merge pull request #50177 from amosbird/fix_50094
Fix broken index analysis when binary operator contains a null constant argument
This commit is contained in:
commit
60dccff77c
@ -1334,6 +1334,10 @@ bool KeyCondition::isKeyPossiblyWrappedByMonotonicFunctions(
|
||||
arguments.push_back(const_arg);
|
||||
kind = FunctionWithOptionalConstArg::Kind::RIGHT_CONST;
|
||||
}
|
||||
|
||||
/// If constant arg of binary operator is NULL, there will be no monotonicity.
|
||||
if (const_arg.column->isNullAt(0))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
arguments.push_back({ nullptr, key_column_type, "" });
|
||||
|
@ -0,0 +1,12 @@
|
||||
drop table if exists tab;
|
||||
|
||||
create table tab (x DateTime) engine MergeTree order by x;
|
||||
|
||||
SELECT toDateTime(65537, toDateTime(NULL), NULL)
|
||||
FROM tab
|
||||
WHERE ((x + CAST('1', 'Nullable(UInt8)')) <= 2) AND ((x + CAST('', 'Nullable(UInt8)')) <= 256)
|
||||
ORDER BY
|
||||
toDateTime(toDateTime(-2, NULL, NULL) + 100.0001, NULL, -2, NULL) DESC NULLS LAST,
|
||||
x ASC NULLS LAST;
|
||||
|
||||
drop table tab;
|
Loading…
Reference in New Issue
Block a user