mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-29 19:12:03 +00:00
fix abs monotonicity
Signed-off-by: Duc Canh Le <duccanh.le@ahrefs.com>
This commit is contained in:
parent
0ac60137f0
commit
4b7abbce68
@ -45,7 +45,7 @@ template <> struct FunctionUnaryArithmeticMonotonicity<NameAbs>
|
|||||||
if ((left_float < 0 && right_float > 0) || (left_float > 0 && right_float < 0))
|
if ((left_float < 0 && right_float > 0) || (left_float > 0 && right_float < 0))
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
return { .is_monotonic = true, .is_positive = left_float > 0, .is_strict = true, };
|
return { .is_monotonic = true, .is_positive = std::min(left_float, right_float) >= 0, .is_strict = true, };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2860,9 +2860,9 @@ bool KeyCondition::mayBeTrueInRange(
|
|||||||
String KeyCondition::RPNElement::toString() const
|
String KeyCondition::RPNElement::toString() const
|
||||||
{
|
{
|
||||||
if (argument_num_of_space_filling_curve)
|
if (argument_num_of_space_filling_curve)
|
||||||
return toString(fmt::format("argument {} of column {}", *argument_num_of_space_filling_curve, key_column), false);
|
return toString(fmt::format("argument {} of column {}", *argument_num_of_space_filling_curve, key_column), true);
|
||||||
else
|
else
|
||||||
return toString(fmt::format("column {}", key_column), false);
|
return toString(fmt::format("column {}", key_column), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
String KeyCondition::RPNElement::toString(std::string_view column_name, bool print_constants) const
|
String KeyCondition::RPNElement::toString(std::string_view column_name, bool print_constants) const
|
||||||
|
@ -0,0 +1,2 @@
|
|||||||
|
1 2023-05-04 22:17:23 0
|
||||||
|
2 2023-05-04 22:17:23 0
|
@ -0,0 +1,6 @@
|
|||||||
|
CREATE TABLE t (id UInt64, ts DateTime) ENGINE = MergeTree() ORDER BY (id, ts) SETTINGS index_granularity = 2;
|
||||||
|
|
||||||
|
INSERT INTO t VALUES (1, '2023-05-04 21:17:23') (1, '2023-05-04 22:17:23') (2, '2023-05-04 22:17:23') (2, '2023-05-04 23:17:23');
|
||||||
|
|
||||||
|
SELECT *, abs(toUnixTimestamp(ts) - toUnixTimestamp(1683238643)) AS error FROM t WHERE error < 3600;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user