fix for floats

This commit is contained in:
Denis Zhuravlev 2020-10-19 10:52:28 -03:00
parent 1dea2fd1dd
commit 5cd396b1b5
2 changed files with 2095 additions and 2096 deletions

View File

@ -2,11 +2,11 @@ DROP TABLE IF EXISTS testNullableStates;
DROP TABLE IF EXISTS testNullableStatesAgg; DROP TABLE IF EXISTS testNullableStatesAgg;
CREATE TABLE testNullableStates ( CREATE TABLE testNullableStates (
ts DateTime, ts DateTime,
id String, id String,
string Nullable(String), string Nullable(String),
float64 Nullable(Float64), float64 Nullable(Float64),
float32 Nullable(Float32), float32 Nullable(Float32),
decimal325 Nullable(Decimal32(5)), decimal325 Nullable(Decimal32(5)),
date Nullable(Date), date Nullable(Date),
datetime Nullable(DateTime), datetime Nullable(DateTime),
@ -100,47 +100,47 @@ ORDER BY id;
insert into testNullableStatesAgg insert into testNullableStatesAgg
select select
ts DateTime, ts DateTime,
id String, id String,
minState(string) stringMin, minState(string) stringMin,
maxState(string) stringMax, maxState(string) stringMax,
minState(float64) float64Min, minState(float64) float64Min,
maxState(float64) float64Max, maxState(float64) float64Max,
avgState(float64) float64Avg, avgState(float64) float64Avg,
sumState(float64) float64Sum, sumState(float64) float64Sum,
minState(float32) float32Min, minState(float32) float32Min,
maxState(float32) float32Max, maxState(float32) float32Max,
avgState(float32) float32Avg, avgState(float32) float32Avg,
sumState(float32) float32Sum, sumState(float32) float32Sum,
minState(decimal325) decimal325Min, minState(decimal325) decimal325Min,
maxState(decimal325) decimal325Max, maxState(decimal325) decimal325Max,
avgState(decimal325) decimal325Avg, avgState(decimal325) decimal325Avg,
sumState(decimal325) decimal325Sum, sumState(decimal325) decimal325Sum,
minState(date) dateMin, minState(date) dateMin,
maxState(date) dateMax, maxState(date) dateMax,
minState(datetime) datetimeMin, minState(datetime) datetimeMin,
maxState(datetime) datetimeMax, maxState(datetime) datetimeMax,
minState(datetime64) datetime64Min, minState(datetime64) datetime64Min,
maxState(datetime64) datetime64Max, maxState(datetime64) datetime64Max,
minState(int64) int64Min, minState(int64) int64Min,
maxState(int64) int64Max, maxState(int64) int64Max,
avgState(int64) int64Avg, avgState(int64) int64Avg,
sumState(int64) int64Sum, sumState(int64) int64Sum,
minState(int32) int32Min, minState(int32) int32Min,
maxState(int32) int32Max, maxState(int32) int32Max,
avgState(int32) int32Avg, avgState(int32) int32Avg,
sumState(int32) int32Sum, sumState(int32) int32Sum,
minState(int16) int16Min, minState(int16) int16Min,
maxState(int16) int16Max, maxState(int16) int16Max,
avgState(int16) int16Avg, avgState(int16) int16Avg,
sumState(int16) int16Sum, sumState(int16) int16Sum,
minState(int8) int8Min, minState(int8) int8Min,
maxState(int8) int8Max, maxState(int8) int8Max,
avgState(int8) int8Avg, avgState(int8) int8Avg,
sumState(int8) int8Sum sumState(int8) int8Sum
from testNullableStates from testNullableStates
group by ts, id; group by ts, id;
OPTIMIZE TABLE testNullableStatesAgg FINAL; OPTIMIZE TABLE testNullableStatesAgg FINAL;
select count() from testNullableStates; select count() from testNullableStates;
@ -152,14 +152,14 @@ select ' ---- select without states ---- ';
SELECT id, count(), SELECT id, count(),
min(string), min(string),
max(string), max(string),
min(float64), floor(min(float64),5),
max(float64), floor(max(float64),5),
avg(float64), floor(avg(float64),5),
sum(float64), floor(sum(float64),5),
min(float32), floor(min(float32),5),
max(float32), floor(max(float32),5),
avg(float32), floor(avg(float32),5),
sum(float32), floor(sum(float32),5),
min(decimal325), min(decimal325),
max(decimal325), max(decimal325),
avg(decimal325), avg(decimal325),
@ -185,8 +185,8 @@ SELECT id, count(),
min(int8), min(int8),
max(int8), max(int8),
avg(int8), avg(int8),
sum(int8) sum(int8)
FROM testNullableStates FROM testNullableStates
GROUP BY id GROUP BY id
ORDER BY id ASC; ORDER BY id ASC;
@ -195,14 +195,14 @@ select ' ---- select with states ---- ';
SELECT id, count(), SELECT id, count(),
minMerge(stringMin), minMerge(stringMin),
maxMerge(stringMax), maxMerge(stringMax),
minMerge(float64Min), floor(minMerge(float64Min),5),
maxMerge(float64Max), floor(maxMerge(float64Max),5),
avgMerge(float64Avg), floor(avgMerge(float64Avg),5),
sumMerge(float64Sum), floor(sumMerge(float64Sum),5),
minMerge(float32Min), floor(minMerge(float32Min),5),
maxMerge(float32Max), floor(maxMerge(float32Max),5),
avgMerge(float32Avg), floor(avgMerge(float32Avg),5),
sumMerge(float32Sum), floor(sumMerge(float32Sum),5),
minMerge(decimal325Min), minMerge(decimal325Min),
maxMerge(decimal325Max), maxMerge(decimal325Max),
avgMerge(decimal325Avg), avgMerge(decimal325Avg),
@ -228,8 +228,8 @@ SELECT id, count(),
minMerge(int8Min), minMerge(int8Min),
maxMerge(int8Max), maxMerge(int8Max),
avgMerge(int8Avg), avgMerge(int8Avg),
sumMerge(int8Sum) sumMerge(int8Sum)
FROM testNullableStatesAgg FROM testNullableStatesAgg
GROUP BY id GROUP BY id
ORDER BY id ASC; ORDER BY id ASC;
@ -239,14 +239,14 @@ select ' ---- select row with nulls without states ---- ';
SELECT id, count(), SELECT id, count(),
min(string), min(string),
max(string), max(string),
min(float64), floor(min(float64),5),
max(float64), floor(max(float64),5),
avg(float64), floor(avg(float64),5),
sum(float64), floor(sum(float64),5),
min(float32), floor(min(float32),5),
max(float32), floor(max(float32),5),
avg(float32), floor(avg(float32),5),
sum(float32), floor(sum(float32),5),
min(decimal325), min(decimal325),
max(decimal325), max(decimal325),
avg(decimal325), avg(decimal325),
@ -272,8 +272,8 @@ SELECT id, count(),
min(int8), min(int8),
max(int8), max(int8),
avg(int8), avg(int8),
sum(int8) sum(int8)
FROM testNullableStates FROM testNullableStates
WHERE id = '-2' WHERE id = '-2'
GROUP BY id GROUP BY id
ORDER BY id ASC; ORDER BY id ASC;
@ -283,14 +283,14 @@ select ' ---- select row with nulls with states ---- ';
SELECT id, count(), SELECT id, count(),
minMerge(stringMin), minMerge(stringMin),
maxMerge(stringMax), maxMerge(stringMax),
minMerge(float64Min), floor(minMerge(float64Min),5),
maxMerge(float64Max), floor(maxMerge(float64Max),5),
avgMerge(float64Avg), floor(avgMerge(float64Avg),5),
sumMerge(float64Sum), floor(sumMerge(float64Sum),5),
minMerge(float32Min), floor(minMerge(float32Min),5),
maxMerge(float32Max), floor(maxMerge(float32Max),5),
avgMerge(float32Avg), floor(avgMerge(float32Avg),5),
sumMerge(float32Sum), floor(sumMerge(float32Sum),5),
minMerge(decimal325Min), minMerge(decimal325Min),
maxMerge(decimal325Max), maxMerge(decimal325Max),
avgMerge(decimal325Avg), avgMerge(decimal325Avg),
@ -316,8 +316,8 @@ SELECT id, count(),
minMerge(int8Min), minMerge(int8Min),
maxMerge(int8Max), maxMerge(int8Max),
avgMerge(int8Avg), avgMerge(int8Avg),
sumMerge(int8Sum) sumMerge(int8Sum)
FROM testNullableStatesAgg FROM testNullableStatesAgg
WHERE id = '-2' WHERE id = '-2'
GROUP BY id GROUP BY id
ORDER BY id ASC; ORDER BY id ASC;
@ -328,14 +328,14 @@ select ' ---- select no rows without states ---- ';
SELECT count(), SELECT count(),
min(string), min(string),
max(string), max(string),
min(float64), floor(min(float64),5),
max(float64), floor(max(float64),5),
avg(float64), floor(avg(float64),5),
sum(float64), floor(sum(float64),5),
min(float32), floor(min(float32),5),
max(float32), floor(max(float32),5),
avg(float32), floor(avg(float32),5),
sum(float32), floor(sum(float32),5),
min(decimal325), min(decimal325),
max(decimal325), max(decimal325),
avg(decimal325), avg(decimal325),
@ -361,8 +361,8 @@ SELECT count(),
min(int8), min(int8),
max(int8), max(int8),
avg(int8), avg(int8),
sum(int8) sum(int8)
FROM testNullableStates FROM testNullableStates
WHERE id = '-22'; WHERE id = '-22';
select ' ---- select no rows with states ---- '; select ' ---- select no rows with states ---- ';
@ -370,14 +370,14 @@ select ' ---- select no rows with states ---- ';
SELECT count(), SELECT count(),
minMerge(stringMin), minMerge(stringMin),
maxMerge(stringMax), maxMerge(stringMax),
minMerge(float64Min), floor(minMerge(float64Min),5),
maxMerge(float64Max), floor(maxMerge(float64Max),5),
avgMerge(float64Avg), floor(avgMerge(float64Avg),5),
sumMerge(float64Sum), floor(sumMerge(float64Sum),5),
minMerge(float32Min), floor(minMerge(float32Min),5),
maxMerge(float32Max), floor(maxMerge(float32Max),5),
avgMerge(float32Avg), floor(avgMerge(float32Avg),5),
sumMerge(float32Sum), floor(sumMerge(float32Sum),5),
minMerge(decimal325Min), minMerge(decimal325Min),
maxMerge(decimal325Max), maxMerge(decimal325Max),
avgMerge(decimal325Avg), avgMerge(decimal325Avg),
@ -403,10 +403,9 @@ SELECT count(),
minMerge(int8Min), minMerge(int8Min),
maxMerge(int8Max), maxMerge(int8Max),
avgMerge(int8Avg), avgMerge(int8Avg),
sumMerge(int8Sum) sumMerge(int8Sum)
FROM testNullableStatesAgg FROM testNullableStatesAgg
WHERE id = '-22'; WHERE id = '-22';
DROP TABLE testNullableStates; DROP TABLE testNullableStates;
DROP TABLE testNullableStatesAgg; DROP TABLE testNullableStatesAgg;