mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
add tests
This commit is contained in:
parent
b30167576d
commit
f8f71f7327
@ -785,7 +785,7 @@ struct ArrayDifferenceImpl
|
||||
res_values[pos] = 0;
|
||||
for (++pos; pos < offsets[i]; ++pos)
|
||||
{
|
||||
res_values[pos] = static_cast<Int64>(data[pos]) - static_cast<Int64>(data[pos - 1]);
|
||||
res_values[pos] = static_cast<Result>(data[pos]) - static_cast<Result>(data[pos - 1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
[1,3,6,10]
|
||||
[1,0,5,3]
|
||||
[0,1,1,1]
|
||||
[0,6,93,-95]
|
||||
[1,0,0,1]
|
||||
[1,1.4,1.2999999999999998]
|
||||
[1, 4, 5]
|
||||
[0,-4,3,1]
|
||||
[0,-0.6,-0.5]
|
||||
[0,2,-2]
|
@ -0,0 +1,28 @@
|
||||
DROP TABLE IF EXISTS test.test;
|
||||
|
||||
SELECT arrayCumSumLimited([1, 2, 3, 4]);
|
||||
|
||||
SELECT arrayCumSumLimited([1, -5, 5, -2]);
|
||||
|
||||
SELECT arrayDifference([1, 2, 3, 4]);
|
||||
|
||||
SELECT arrayDifference([1, 7, 100, 5]);
|
||||
|
||||
CREATE TABLE test.test(a Array(Int64), b Array(Float64), c Array(UInt64)) ENGINE=Memory;
|
||||
|
||||
INSERT INTO test.test VALUES ([1, -3, 0, 1], [1.0, 0.4, -0.1], [1, 3, 1]);
|
||||
|
||||
SELECT arrayCumSumLimited(a) FROM test.test;
|
||||
|
||||
SELECT arrayCumSumLimited(b) FROM test.test;
|
||||
|
||||
SELECT arrayCumSumLimited(c) FROM test.test;
|
||||
|
||||
SELECT arrayDifference(a) FROM test.test;
|
||||
|
||||
SELECT arrayDifference(b) FROM test.test;
|
||||
|
||||
SELECT arrayDifference(c) FROM test.test;
|
||||
|
||||
DROP TABLE IF EXISTS test.test;
|
||||
|
Loading…
Reference in New Issue
Block a user