mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 17:41:59 +00:00
Added tests
This commit is contained in:
parent
a5306396dd
commit
5b2bb62085
@ -13,6 +13,11 @@
|
||||
([1,2,3,4,5,6,7,8,9,10],[1,0,2,0,0,0,0,0,0,0])
|
||||
([1,2,3,4,5,6,7,8,9,10],[1,0,0,2,0,0,0,0,0,0])
|
||||
([1,2,3,4,5,6,7,8,9,10],[1,0,0,0,2,0,0,0,0,0])
|
||||
([1,2,3,4,5,6,7,8,9,10],[1,0,0,0,0,0,0,0,0,0])
|
||||
([1,2,3,4,5,6,7,8,9,10],[1,2,0,0,0,0,0,0,0,0])
|
||||
([1,2,3,4,5,6,7,8,9,10],[1,0,2,0,0,0,0,0,0,0])
|
||||
([1,2,3,4,5,6,7,8,9,10],[1,0,0,2,0,0,0,0,0,0])
|
||||
([1,2,3,4,5,6,7,8,9,10],[1,0,0,0,2,0,0,0,0,0])
|
||||
([1,2],[1,0])
|
||||
([1,2,3],[1,2,0])
|
||||
([1,2,3,4],[1,0,2,0])
|
||||
|
@ -4,7 +4,7 @@ create table map_test engine=TinyLog() as (select (number + 1) as n, ([1, number
|
||||
select mapPopulateSeries(map.1, map.2) from map_test;
|
||||
select mapPopulateSeries(map.1, map.2, toUInt64(3)) from map_test;
|
||||
select mapPopulateSeries(map.1, map.2, toUInt64(10)) from map_test;
|
||||
select mapPopulateSeries(map.1, map.2, 1000) from map_test; -- { serverError 43 }
|
||||
select mapPopulateSeries(map.1, map.2, 10) from map_test;
|
||||
select mapPopulateSeries(map.1, map.2, n) from map_test;
|
||||
select mapPopulateSeries(map.1, [11,22]) from map_test;
|
||||
select mapPopulateSeries([3, 4], map.2) from map_test;
|
||||
@ -31,6 +31,6 @@ select mapPopulateSeries([toInt64(-10), 2], [toInt64(1), 1], toInt64(-5)) as res
|
||||
-- empty
|
||||
select mapPopulateSeries(cast([], 'Array(UInt8)'), cast([], 'Array(UInt8)'), 5);
|
||||
|
||||
select mapPopulateSeries(['1', '2'], [1,1]) as res, toTypeName(res); -- { serverError 43 }
|
||||
select mapPopulateSeries([1, 2, 3], [1,1]) as res, toTypeName(res); -- { serverError 42 }
|
||||
select mapPopulateSeries([1, 2], [1,1,1]) as res, toTypeName(res); -- { serverError 42 }
|
||||
select mapPopulateSeries(['1', '2'], [1, 1]) as res, toTypeName(res); -- { serverError 43 }
|
||||
select mapPopulateSeries([1, 2, 3], [1, 1]) as res, toTypeName(res); -- { serverError 36 }
|
||||
select mapPopulateSeries([1, 2], [1, 1, 1]) as res, toTypeName(res); -- { serverError 36 }
|
||||
|
@ -20,7 +20,12 @@ select mapPopulateSeries(m, toUInt64(10)) from map_test;
|
||||
{1:1,2:0,3:2,4:0,5:0,6:0,7:0,8:0,9:0,10:0}
|
||||
{1:1,2:0,3:0,4:2,5:0,6:0,7:0,8:0,9:0,10:0}
|
||||
{1:1,2:0,3:0,4:0,5:2,6:0,7:0,8:0,9:0,10:0}
|
||||
select mapPopulateSeries(m, 1000) from map_test; -- { serverError 43 }
|
||||
select mapPopulateSeries(m, 10) from map_test;
|
||||
{1:1,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:0}
|
||||
{1:1,2:2,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:0}
|
||||
{1:1,2:0,3:2,4:0,5:0,6:0,7:0,8:0,9:0,10:0}
|
||||
{1:1,2:0,3:0,4:2,5:0,6:0,7:0,8:0,9:0,10:0}
|
||||
{1:1,2:0,3:0,4:0,5:2,6:0,7:0,8:0,9:0,10:0}
|
||||
select mapPopulateSeries(m, n) from map_test;
|
||||
{1:1,2:0}
|
||||
{1:1,2:2,3:0}
|
||||
|
@ -6,7 +6,7 @@ create table map_test engine=TinyLog() as (select (number + 1) as n, map(1, 1, n
|
||||
select mapPopulateSeries(m) from map_test;
|
||||
select mapPopulateSeries(m, toUInt64(3)) from map_test;
|
||||
select mapPopulateSeries(m, toUInt64(10)) from map_test;
|
||||
select mapPopulateSeries(m, 1000) from map_test; -- { serverError 43 }
|
||||
select mapPopulateSeries(m, 10) from map_test;
|
||||
select mapPopulateSeries(m, n) from map_test;
|
||||
|
||||
drop table map_test;
|
||||
|
@ -0,0 +1,34 @@
|
||||
mapPopulateSeries with map
|
||||
Without max key
|
||||
{0:5}
|
||||
{0:5,1:0,2:0,3:0,4:0,5:10}
|
||||
{-5:-5,-4:0,-3:0,-2:0,-1:0,0:5,1:0,2:0,3:0,4:0,5:10}
|
||||
{-5:-5,-4:0,-3:0,-2:0,-1:0,0:5,1:0,2:0,3:0,4:0,5:10,6:0,7:0,8:0,9:0,10:15}
|
||||
With max key
|
||||
{0:5,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:0,11:0,12:0,13:0,14:0,15:0,16:0,17:0,18:0,19:0,20:0}
|
||||
{0:5,1:0,2:0,3:0,4:0,5:10,6:0,7:0,8:0,9:0,10:0,11:0,12:0,13:0,14:0,15:0,16:0,17:0,18:0,19:0,20:0}
|
||||
{-5:-5,-4:0,-3:0,-2:0,-1:0,0:5,1:0,2:0,3:0,4:0,5:10}
|
||||
{-5:-5,-4:0,-3:0,-2:0,-1:0,0:5,1:0,2:0,3:0,4:0,5:10,6:0,7:0,8:0,9:0,10:15,11:0,12:0,13:0,14:0,15:0,16:0,17:0,18:0,19:0,20:0}
|
||||
Possible verflow
|
||||
{18446744073709551610:5,18446744073709551611:0,18446744073709551612:0,18446744073709551613:0,18446744073709551614:0,18446744073709551615:0}
|
||||
{18446744073709551615:5}
|
||||
Duplicate keys
|
||||
{1:4,2:0,3:0,4:0,5:6}
|
||||
{1:4,2:0,3:0,4:0,5:6,6:0,7:0,8:0,9:0,10:0}
|
||||
mapPopulateSeries with two arrays
|
||||
Without max key
|
||||
([0],[5])
|
||||
([0,1,2,3,4,5],[5,0,0,0,0,10])
|
||||
([-5,-4,-3,-2,-1,0,1,2,3,4,5],[-5,0,0,0,0,5,0,0,0,0,10])
|
||||
([-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10],[-5,0,0,0,0,5,0,0,0,0,10,0,0,0,0,15])
|
||||
With max key
|
||||
([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20],[5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])
|
||||
([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20],[5,0,0,0,0,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])
|
||||
([-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20],[-5,0,0,0,0,5,0,0,0,0,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])
|
||||
([-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20],[-5,0,0,0,0,5,0,0,0,0,10,0,0,0,0,15,0,0,0,0,0,0,0,0,0,0])
|
||||
Possible verflow
|
||||
([18446744073709551610,18446744073709551611,18446744073709551612,18446744073709551613,18446744073709551614,18446744073709551615],[5,0,0,0,0,0])
|
||||
([18446744073709551615],[5])
|
||||
Duplicate keys
|
||||
([1,2,3,4,5],[4,0,0,0,6])
|
||||
([1,2,3,4,5,6,7,8,9,10],[4,0,0,0,6,0,0,0,0,0])
|
@ -0,0 +1,125 @@
|
||||
DROP TABLE IF EXISTS 02005_test_table;
|
||||
CREATE TABLE 02005_test_table
|
||||
(
|
||||
value Map(Int64, Int64)
|
||||
)
|
||||
ENGINE = TinyLog;
|
||||
|
||||
SELECT 'mapPopulateSeries with map';
|
||||
|
||||
SELECT 'Without max key';
|
||||
|
||||
SELECT mapPopulateSeries(value) FROM 02005_test_table;
|
||||
TRUNCATE TABLE 02005_test_table;
|
||||
|
||||
INSERT INTO 02005_test_table VALUES (map(0, 5));
|
||||
SELECT mapPopulateSeries(value) FROM 02005_test_table;
|
||||
TRUNCATE TABLE 02005_test_table;
|
||||
|
||||
INSERT INTO 02005_test_table VALUES (map(0, 5, 5, 10));
|
||||
SELECT mapPopulateSeries(value) FROM 02005_test_table;
|
||||
TRUNCATE TABLE 02005_test_table;
|
||||
|
||||
INSERT INTO 02005_test_table VALUES (map(-5, -5, 0, 5, 5, 10));
|
||||
SELECT mapPopulateSeries(value) FROM 02005_test_table;
|
||||
TRUNCATE TABLE 02005_test_table;
|
||||
|
||||
INSERT INTO 02005_test_table VALUES (map(-5, -5, 0, 5, 5, 10, 10, 15));
|
||||
SELECT mapPopulateSeries(value) FROM 02005_test_table;
|
||||
TRUNCATE TABLE 02005_test_table;
|
||||
|
||||
SELECT 'With max key';
|
||||
|
||||
SELECT mapPopulateSeries(value, materialize(20)) FROM 02005_test_table;
|
||||
TRUNCATE TABLE 02005_test_table;
|
||||
|
||||
INSERT INTO 02005_test_table VALUES (map(0, 5));
|
||||
SELECT mapPopulateSeries(value, materialize(20)) FROM 02005_test_table;
|
||||
TRUNCATE TABLE 02005_test_table;
|
||||
|
||||
INSERT INTO 02005_test_table VALUES (map(0, 5, 5, 10));
|
||||
SELECT mapPopulateSeries(value, materialize(20)) FROM 02005_test_table;
|
||||
TRUNCATE TABLE 02005_test_table;
|
||||
|
||||
INSERT INTO 02005_test_table VALUES (map(-5, -5, 0, 5, 5, 10));
|
||||
SELECT mapPopulateSeries(value) FROM 02005_test_table;
|
||||
TRUNCATE TABLE 02005_test_table;
|
||||
|
||||
INSERT INTO 02005_test_table VALUES (map(-5, -5, 0, 5, 5, 10, 10, 15));
|
||||
SELECT mapPopulateSeries(value, materialize(20)) FROM 02005_test_table;
|
||||
TRUNCATE TABLE 02005_test_table;
|
||||
|
||||
SELECT 'Possible verflow';
|
||||
|
||||
SELECT mapPopulateSeries(map(toUInt64(18446744073709551610), toUInt64(5)), 18446744073709551615);
|
||||
SELECT mapPopulateSeries(map(toUInt64(18446744073709551615), toUInt64(5)), 18446744073709551615);
|
||||
|
||||
SELECT 'Duplicate keys';
|
||||
|
||||
SELECT mapPopulateSeries(map(1, 4, 1, 5, 5, 6));
|
||||
SELECT mapPopulateSeries(map(1, 4, 1, 5, 5, 6), materialize(10));
|
||||
|
||||
DROP TABLE 02005_test_table;
|
||||
|
||||
DROP TABLE IF EXISTS 02005_test_table;
|
||||
CREATE TABLE 02005_test_table
|
||||
(
|
||||
key Array(Int64),
|
||||
value Array(Int64)
|
||||
)
|
||||
ENGINE = TinyLog;
|
||||
|
||||
SELECT 'mapPopulateSeries with two arrays';
|
||||
SELECT 'Without max key';
|
||||
|
||||
SELECT mapPopulateSeries(key, value) FROM 02005_test_table;
|
||||
TRUNCATE TABLE 02005_test_table;
|
||||
|
||||
INSERT INTO 02005_test_table VALUES ([0], [5]);
|
||||
SELECT mapPopulateSeries(key, value) FROM 02005_test_table;
|
||||
TRUNCATE TABLE 02005_test_table;
|
||||
|
||||
INSERT INTO 02005_test_table VALUES ([0, 5], [5, 10]);
|
||||
SELECT mapPopulateSeries(key, value) FROM 02005_test_table;
|
||||
TRUNCATE TABLE 02005_test_table;
|
||||
|
||||
INSERT INTO 02005_test_table VALUES ([-5, 0, 5], [-5, 5, 10]);
|
||||
SELECT mapPopulateSeries(key, value) FROM 02005_test_table;
|
||||
TRUNCATE TABLE 02005_test_table;
|
||||
|
||||
INSERT INTO 02005_test_table VALUES ([-5, 0, 5, 10], [-5, 5, 10, 15]);
|
||||
SELECT mapPopulateSeries(key, value) FROM 02005_test_table;
|
||||
TRUNCATE TABLE 02005_test_table;
|
||||
|
||||
SELECT 'With max key';
|
||||
|
||||
SELECT mapPopulateSeries(key, value, materialize(20)) FROM 02005_test_table;
|
||||
TRUNCATE TABLE 02005_test_table;
|
||||
|
||||
INSERT INTO 02005_test_table VALUES ([0], [5]);
|
||||
SELECT mapPopulateSeries(key, value, materialize(20)) FROM 02005_test_table;
|
||||
TRUNCATE TABLE 02005_test_table;
|
||||
|
||||
INSERT INTO 02005_test_table VALUES ([0, 5], [5, 10]);
|
||||
SELECT mapPopulateSeries(key, value, materialize(20)) FROM 02005_test_table;
|
||||
TRUNCATE TABLE 02005_test_table;
|
||||
|
||||
INSERT INTO 02005_test_table VALUES ([-5, 0, 5], [-5, 5, 10]);
|
||||
SELECT mapPopulateSeries(key, value, materialize(20)) FROM 02005_test_table;
|
||||
TRUNCATE TABLE 02005_test_table;
|
||||
|
||||
INSERT INTO 02005_test_table VALUES ([-5, 0, 5, 10], [-5, 5, 10, 15]);
|
||||
SELECT mapPopulateSeries(key, value, materialize(20)) FROM 02005_test_table;
|
||||
TRUNCATE TABLE 02005_test_table;
|
||||
|
||||
SELECT 'Possible verflow';
|
||||
|
||||
SELECT mapPopulateSeries([18446744073709551610], [5], 18446744073709551615);
|
||||
SELECT mapPopulateSeries([18446744073709551615], [5], 18446744073709551615);
|
||||
|
||||
SELECT 'Duplicate keys';
|
||||
|
||||
SELECT mapPopulateSeries([1, 1, 5], [4, 5, 6]);
|
||||
SELECT mapPopulateSeries([1, 1, 5], [4, 5, 6], materialize(10));
|
||||
|
||||
DROP TABLE 02005_test_table;
|
Loading…
Reference in New Issue
Block a user