mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-19 16:20:50 +00:00
Merge pull request #47322 from evillique/running_difference
Add support for big int types to runningDifference() function
This commit is contained in:
commit
44531e5f85
@ -70,7 +70,7 @@ private:
|
||||
|
||||
if (!has_prev_value)
|
||||
{
|
||||
dst[i] = is_first_line_zero ? 0 : src[i];
|
||||
dst[i] = is_first_line_zero ? static_cast<Dst>(0) : static_cast<Dst>(src[i]);
|
||||
prev = src[i];
|
||||
has_prev_value = true;
|
||||
}
|
||||
@ -102,6 +102,10 @@ private:
|
||||
f(UInt32());
|
||||
else if (which.isUInt64())
|
||||
f(UInt64());
|
||||
else if (which.isUInt128())
|
||||
f(UInt128());
|
||||
else if (which.isUInt256())
|
||||
f(UInt256());
|
||||
else if (which.isInt8())
|
||||
f(Int8());
|
||||
else if (which.isInt16())
|
||||
@ -110,6 +114,10 @@ private:
|
||||
f(Int32());
|
||||
else if (which.isInt64())
|
||||
f(Int64());
|
||||
else if (which.isInt128())
|
||||
f(Int128());
|
||||
else if (which.isInt256())
|
||||
f(Int256());
|
||||
else if (which.isFloat32())
|
||||
f(Float32());
|
||||
else if (which.isFloat64())
|
||||
|
@ -276,10 +276,14 @@ SELECT runningDifference(CAST( 0 AS Nullable(Int8)));
|
||||
SELECT runningDifference(CAST( 0 AS Nullable(Int16)));
|
||||
SELECT runningDifference(CAST( 0 AS Nullable(Int32)));
|
||||
SELECT runningDifference(CAST( 0 AS Nullable(Int64)));
|
||||
SELECT runningDifference(CAST( 0 AS Nullable(Int128)));
|
||||
SELECT runningDifference(CAST( 0 AS Nullable(Int256)));
|
||||
SELECT runningDifference(CAST( 0 AS Nullable(UInt8)));
|
||||
SELECT runningDifference(CAST( 0 AS Nullable(UInt16)));
|
||||
SELECT runningDifference(CAST( 0 AS Nullable(UInt32)));
|
||||
SELECT runningDifference(CAST( 0 AS Nullable(UInt64)));
|
||||
SELECT runningDifference(CAST( 0 AS Nullable(UInt128)));
|
||||
SELECT runningDifference(CAST( 0 AS Nullable(UInt256)));
|
||||
SELECT runningDifference(CAST( 0 AS Nullable(Float32)));
|
||||
SELECT runningDifference(CAST( 0 AS Nullable(Float64)));
|
||||
SELECT runningDifference(CAST( 0 AS Nullable(Date)));
|
||||
@ -288,10 +292,14 @@ SELECT runningDifference(CAST(NULL AS Nullable(Int8)));
|
||||
SELECT runningDifference(CAST(NULL AS Nullable(Int16)));
|
||||
SELECT runningDifference(CAST(NULL AS Nullable(Int32)));
|
||||
SELECT runningDifference(CAST(NULL AS Nullable(Int64)));
|
||||
SELECT runningDifference(CAST(NULL AS Nullable(Int128)));
|
||||
SELECT runningDifference(CAST(NULL AS Nullable(Int256)));
|
||||
SELECT runningDifference(CAST(NULL AS Nullable(UInt8)));
|
||||
SELECT runningDifference(CAST(NULL AS Nullable(UInt16)));
|
||||
SELECT runningDifference(CAST(NULL AS Nullable(UInt32)));
|
||||
SELECT runningDifference(CAST(NULL AS Nullable(UInt64)));
|
||||
SELECT runningDifference(CAST(NULL AS Nullable(UInt128)));
|
||||
SELECT runningDifference(CAST(NULL AS Nullable(UInt256));
|
||||
SELECT runningDifference(CAST(NULL AS Nullable(Float32)));
|
||||
SELECT runningDifference(CAST(NULL AS Nullable(Float64)));
|
||||
SELECT runningDifference(CAST(NULL AS Nullable(Date)));
|
||||
|
@ -19,6 +19,30 @@
|
||||
\N
|
||||
\N
|
||||
2
|
||||
-
|
||||
0
|
||||
1
|
||||
4
|
||||
5
|
||||
170141183460469231731687303715884105717
|
||||
-
|
||||
0
|
||||
1
|
||||
4
|
||||
5
|
||||
170141183460469231731687303715884105718
|
||||
-
|
||||
0
|
||||
1
|
||||
4
|
||||
5
|
||||
170141183460469231731687303715884105717
|
||||
-
|
||||
0
|
||||
1
|
||||
4
|
||||
5
|
||||
170141183460469231731687303715884105718
|
||||
--Date Difference--
|
||||
\N
|
||||
\N
|
||||
|
@ -5,6 +5,14 @@ select '-';
|
||||
select runningDifference(x) from (select arrayJoin([Null, 1]) as x);
|
||||
select '-';
|
||||
select runningDifference(x) from (select arrayJoin([Null, Null, 1, 3, Null, Null, 5]) as x);
|
||||
select '-';
|
||||
select runningDifference(x) from (select arrayJoin([0, 1, 5, 10, 170141183460469231731687303715884105727]::Array(UInt128)) as x);
|
||||
select '-';
|
||||
select runningDifference(x) from (select arrayJoin([0, 1, 5, 10, 170141183460469231731687303715884105728]::Array(UInt256)) as x);
|
||||
select '-';
|
||||
select runningDifference(x) from (select arrayJoin([0, 1, 5, 10, 170141183460469231731687303715884105727]::Array(Int128)) as x);
|
||||
select '-';
|
||||
select runningDifference(x) from (select arrayJoin([0, 1, 5, 10, 170141183460469231731687303715884105728]::Array(Int256)) as x);
|
||||
select '--Date Difference--';
|
||||
select runningDifference(x) from (select arrayJoin([Null, Null, toDate('1970-1-1'), toDate('1970-12-31'), Null, Null, toDate('2010-8-9')]) as x);
|
||||
select '-';
|
||||
|
Loading…
Reference in New Issue
Block a user