mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-17 20:02:05 +00:00
Merge pull request #50536 from ClickHouse/fix-incorrect-constant-folding
Fix incorrect constant folding
This commit is contained in:
commit
091d6d02f7
@ -829,7 +829,11 @@ static bool parseNumber(char * buffer, size_t size, bool negative, int base, Fie
|
||||
|
||||
if (pos_integer == buffer + size && errno != ERANGE && (!negative || uint_value <= (1ULL << 63)))
|
||||
{
|
||||
if (negative)
|
||||
/// -0 should be still parsed as UInt instead of Int,
|
||||
/// because otherwise it is not preserved during formatting-parsing roundtrip
|
||||
/// (the signedness is lost during formatting)
|
||||
|
||||
if (negative && uint_value != 0)
|
||||
res = static_cast<Int64>(-uint_value);
|
||||
else
|
||||
res = uint_value;
|
||||
|
@ -0,0 +1,4 @@
|
||||
0 UInt8 -1 Int8 -0 Float64
|
||||
0
|
||||
0
|
||||
0
|
@ -0,0 +1,41 @@
|
||||
SELECT -0, toTypeName(-0), -1, toTypeName(-1), -0., toTypeName(-0.);
|
||||
|
||||
DROP TABLE IF EXISTS t4;
|
||||
DROP TABLE IF EXISTS t7;
|
||||
|
||||
create table t4 (c26 String) engine = Log;
|
||||
create view t7 as select max(ref_3.c26) as c_2_c46_1 from t4 as ref_3;
|
||||
|
||||
select
|
||||
c_7_c4585_14 as c_4_c4593_5
|
||||
from
|
||||
(select
|
||||
avg(0) as c_7_c4572_1,
|
||||
max(-0) as c_7_c4585_14
|
||||
from
|
||||
t7 as ref_0
|
||||
group by ref_0.c_2_c46_1) as subq_0
|
||||
where c_4_c4593_5 <= multiIf(true, 1, exp10(c_4_c4593_5) <= 1, 1, 1);
|
||||
|
||||
select x as c
|
||||
from
|
||||
(select 1 AS k,
|
||||
max(0) as a,
|
||||
max(-0) as x
|
||||
from
|
||||
t7 GROUP BY k)
|
||||
where NOT ignore(c);
|
||||
|
||||
SELECT x
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
avg(0) AS c_7_c4572_1,
|
||||
max(-0) AS x
|
||||
FROM t7 AS ref_0
|
||||
GROUP BY ref_0.c_2_c46_1
|
||||
)
|
||||
WHERE x <= multiIf(true, 1, exp10(x) <= 1, 1, 1);
|
||||
|
||||
DROP TABLE t7;
|
||||
DROP TABLE t4;
|
Loading…
Reference in New Issue
Block a user