mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 10:02:01 +00:00
Fix strange code in date monotonicity
This commit is contained in:
parent
22f87e2bf9
commit
7bf1f4cdfa
@ -2243,15 +2243,24 @@ struct ToDateMonotonicity
|
||||
{
|
||||
auto which = WhichDataType(type);
|
||||
if (which.isDateOrDate32() || which.isDateTime() || which.isDateTime64() || which.isInt8() || which.isInt16() || which.isUInt8() || which.isUInt16())
|
||||
{
|
||||
return { .is_monotonic = true, .is_always_monotonic = true };
|
||||
}
|
||||
else if (
|
||||
(which.isUInt() && ((left.isNull() || left.get<UInt64>() < 0xFFFF) && (right.isNull() || right.get<UInt64>() >= 0xFFFF)))
|
||||
|| (which.isInt() && ((left.isNull() || left.get<Int64>() < 0xFFFF) && (right.isNull() || right.get<Int64>() >= 0xFFFF)))
|
||||
|| (which.isFloat() && ((left.isNull() || left.get<Float64>() < 0xFFFF) && (right.isNull() || right.get<Float64>() >= 0xFFFF)))
|
||||
|| !type.isValueRepresentedByNumber())
|
||||
((left.getType() == Field::Types::UInt64 || left.isNull()) && (right.getType() == Field::Types::UInt64 || right.isNull())
|
||||
&& ((left.isNull() || left.get<UInt64>() < 0xFFFF) && (right.isNull() || right.get<UInt64>() >= 0xFFFF)))
|
||||
|| ((left.getType() == Field::Types::Int64 || left.isNull()) && (right.getType() == Field::Types::Int64 || right.isNull())
|
||||
&& ((left.isNull() || left.get<Int64>() < 0xFFFF) && (right.isNull() || right.get<Int64>() >= 0xFFFF)))
|
||||
|| (((left.getType() == Field::Types::Float64 || left.isNull()) && (right.getType() == Field::Types::Float64 || right.isNull())
|
||||
&& ((left.isNull() || left.get<Float64>() < 0xFFFF) && (right.isNull() || right.get<Float64>() >= 0xFFFF))))
|
||||
|| !isNativeNumber(type))
|
||||
{
|
||||
return {};
|
||||
}
|
||||
else
|
||||
{
|
||||
return { .is_monotonic = true, .is_always_monotonic = true };
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -0,0 +1 @@
|
||||
1
|
@ -0,0 +1,5 @@
|
||||
DROP TABLE IF EXISTS tdm__fuzz_23;
|
||||
CREATE TABLE tdm__fuzz_23 (`x` UInt256) ENGINE = MergeTree ORDER BY x SETTINGS write_final_mark = 0;
|
||||
INSERT INTO tdm__fuzz_23 FORMAT Values (1);
|
||||
SELECT count(x) FROM tdm__fuzz_23 WHERE toDate(x) < toDate(now(), 'Asia/Istanbul') SETTINGS max_rows_to_read = 1;
|
||||
DROP TABLE tdm__fuzz_23;
|
Loading…
Reference in New Issue
Block a user