mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Merge pull request #27692 from ClickHouse/map-data-type-parsing-tests
Map data type parsing tests
This commit is contained in:
commit
88f75375de
@ -79,7 +79,7 @@ void DataTypeMap::assertKeyType() const
|
||||
std::string DataTypeMap::doGetName() const
|
||||
{
|
||||
WriteBufferFromOwnString s;
|
||||
s << "Map(" << key_type->getName() << "," << value_type->getName() << ")";
|
||||
s << "Map(" << key_type->getName() << ", " << value_type->getName() << ")";
|
||||
|
||||
return s.str();
|
||||
}
|
||||
|
@ -18,38 +18,38 @@
|
||||
{1:3,2:2,8:2}
|
||||
{1:3,2:2,9:2}
|
||||
{1:3,2:2,10:2}
|
||||
{1:2,2:2} Map(UInt8,UInt64)
|
||||
{1:2,2:2} Map(UInt16,UInt64)
|
||||
{1:2,2:2} Map(UInt32,UInt64)
|
||||
{1:2,2:2} Map(UInt64,UInt64)
|
||||
{1:2,2:2} Map(UInt128,UInt128)
|
||||
{1:2,2:2} Map(UInt256,UInt256)
|
||||
{1:2,2:2} Map(Int16,UInt64)
|
||||
{1:2,2:2} Map(Int16,Int64)
|
||||
{1:2,2:2} Map(Int32,Int64)
|
||||
{1:2,2:2} Map(Int64,Int64)
|
||||
{1:2,2:2} Map(Int128,Int128)
|
||||
{1:2,2:2} Map(Int256,Int256)
|
||||
{1:3.300000023841858,2:2} Map(UInt8,Float64)
|
||||
{1:3.3000000000000003,2:2} Map(UInt8,Float64)
|
||||
{1:2,2:2} Map(UInt8, UInt64)
|
||||
{1:2,2:2} Map(UInt16, UInt64)
|
||||
{1:2,2:2} Map(UInt32, UInt64)
|
||||
{1:2,2:2} Map(UInt64, UInt64)
|
||||
{1:2,2:2} Map(UInt128, UInt128)
|
||||
{1:2,2:2} Map(UInt256, UInt256)
|
||||
{1:2,2:2} Map(Int16, UInt64)
|
||||
{1:2,2:2} Map(Int16, Int64)
|
||||
{1:2,2:2} Map(Int32, Int64)
|
||||
{1:2,2:2} Map(Int64, Int64)
|
||||
{1:2,2:2} Map(Int128, Int128)
|
||||
{1:2,2:2} Map(Int256, Int256)
|
||||
{1:3.300000023841858,2:2} Map(UInt8, Float64)
|
||||
{1:3.3000000000000003,2:2} Map(UInt8, Float64)
|
||||
{'a':1,'b':2}
|
||||
{'a':1,'b':1,'c':1}
|
||||
{'a':1,'b':1,'d':1}
|
||||
{'a':1,'b':2} Map(String,UInt64)
|
||||
{'a':1,'b':1,'c':1} Map(String,UInt64)
|
||||
{'a':1,'b':1,'d':1} Map(String,UInt64)
|
||||
{'a':1,'b':2} Map(String, UInt64)
|
||||
{'a':1,'b':1,'c':1} Map(String, UInt64)
|
||||
{'a':1,'b':1,'d':1} Map(String, UInt64)
|
||||
{'a':1,'b':2}
|
||||
{'a':1,'b':1,'c':1}
|
||||
{'a':1,'b':1,'d':1}
|
||||
{'a':2} Map(Enum16(\'a\' = 1, \'b\' = 2),Int64)
|
||||
{'b':2} Map(Enum16(\'a\' = 1, \'b\' = 2),Int64)
|
||||
{'a':2} Map(Enum8(\'a\' = 1, \'b\' = 2),Int64)
|
||||
{'b':2} Map(Enum8(\'a\' = 1, \'b\' = 2),Int64)
|
||||
{'00000000-89ab-cdef-0123-456789abcdef':2} Map(UUID,Int64)
|
||||
{'11111111-89ab-cdef-0123-456789abcdef':4} Map(UUID,Int64)
|
||||
{1:0,2:0} Map(UInt8,UInt64)
|
||||
{1:18446744073709551615,2:18446744073709551615} Map(UInt8,UInt64)
|
||||
{1:-1,2:-1} Map(UInt8,Int64)
|
||||
{1:-1.0999999761581423,2:0} Map(UInt8,Float64)
|
||||
{1:-1,2:-1} Map(UInt8,Int64)
|
||||
{1:-2,2:-2,3:1} Map(UInt8,Int64)
|
||||
{'a':2} Map(Enum16(\'a\' = 1, \'b\' = 2), Int64)
|
||||
{'b':2} Map(Enum16(\'a\' = 1, \'b\' = 2), Int64)
|
||||
{'a':2} Map(Enum8(\'a\' = 1, \'b\' = 2), Int64)
|
||||
{'b':2} Map(Enum8(\'a\' = 1, \'b\' = 2), Int64)
|
||||
{'00000000-89ab-cdef-0123-456789abcdef':2} Map(UUID, Int64)
|
||||
{'11111111-89ab-cdef-0123-456789abcdef':4} Map(UUID, Int64)
|
||||
{1:0,2:0} Map(UInt8, UInt64)
|
||||
{1:18446744073709551615,2:18446744073709551615} Map(UInt8, UInt64)
|
||||
{1:-1,2:-1} Map(UInt8, Int64)
|
||||
{1:-1.0999999761581423,2:0} Map(UInt8, Float64)
|
||||
{1:-1,2:-1} Map(UInt8, Int64)
|
||||
{1:-2,2:-2,3:1} Map(UInt8, Int64)
|
||||
|
@ -4,15 +4,15 @@ JSON
|
||||
[
|
||||
{
|
||||
"name": "m",
|
||||
"type": "Map(String,UInt32)"
|
||||
"type": "Map(String, UInt32)"
|
||||
},
|
||||
{
|
||||
"name": "m1",
|
||||
"type": "Map(String,Date)"
|
||||
"type": "Map(String, Date)"
|
||||
},
|
||||
{
|
||||
"name": "m2",
|
||||
"type": "Map(String,Array(UInt32))"
|
||||
"type": "Map(String, Array(UInt32))"
|
||||
}
|
||||
],
|
||||
|
||||
|
@ -29,39 +29,39 @@ select mapPopulateSeries(m, n) from map_test;
|
||||
{1:1,2:0,3:0,4:0,5:2,6:0}
|
||||
drop table map_test;
|
||||
select mapPopulateSeries(map(toUInt8(1), toUInt8(1), 2, 1)) as res, toTypeName(res);
|
||||
{1:1,2:1} Map(UInt8,UInt8)
|
||||
{1:1,2:1} Map(UInt8, UInt8)
|
||||
select mapPopulateSeries(map(toUInt16(1), toUInt16(1), 2, 1)) as res, toTypeName(res);
|
||||
{1:1,2:1} Map(UInt16,UInt16)
|
||||
{1:1,2:1} Map(UInt16, UInt16)
|
||||
select mapPopulateSeries(map(toUInt32(1), toUInt32(1), 2, 1)) as res, toTypeName(res);
|
||||
{1:1,2:1} Map(UInt32,UInt32)
|
||||
{1:1,2:1} Map(UInt32, UInt32)
|
||||
select mapPopulateSeries(map(toUInt64(1), toUInt64(1), 2, 1)) as res, toTypeName(res);
|
||||
{1:1,2:1} Map(UInt64,UInt64)
|
||||
{1:1,2:1} Map(UInt64, UInt64)
|
||||
select mapPopulateSeries(map(toUInt128(1), toUInt128(1), 2, 1)) as res, toTypeName(res);
|
||||
{1:1,2:1} Map(UInt128,UInt128)
|
||||
{1:1,2:1} Map(UInt128, UInt128)
|
||||
select mapPopulateSeries(map(toUInt256(1), toUInt256(1), 2, 1)) as res, toTypeName(res);
|
||||
{1:1,2:1} Map(UInt256,UInt256)
|
||||
{1:1,2:1} Map(UInt256, UInt256)
|
||||
select mapPopulateSeries(map(toInt8(1), toInt8(1), 2, 1)) as res, toTypeName(res);
|
||||
{1:1,2:1} Map(Int16,Int16)
|
||||
{1:1,2:1} Map(Int16, Int16)
|
||||
select mapPopulateSeries(map(toInt16(1), toInt16(1), 2, 1)) as res, toTypeName(res);
|
||||
{1:1,2:1} Map(Int16,Int16)
|
||||
{1:1,2:1} Map(Int16, Int16)
|
||||
select mapPopulateSeries(map(toInt32(1), toInt32(1), 2, 1)) as res, toTypeName(res);
|
||||
{1:1,2:1} Map(Int32,Int32)
|
||||
{1:1,2:1} Map(Int32, Int32)
|
||||
select mapPopulateSeries(map(toInt64(1), toInt64(1), 2, 1)) as res, toTypeName(res);
|
||||
{1:1,2:1} Map(Int64,Int64)
|
||||
{1:1,2:1} Map(Int64, Int64)
|
||||
select mapPopulateSeries(map(toInt128(1), toInt128(1), 2, 1)) as res, toTypeName(res);
|
||||
{1:1,2:1} Map(Int128,Int128)
|
||||
{1:1,2:1} Map(Int128, Int128)
|
||||
select mapPopulateSeries(map(toInt256(1), toInt256(1), 2, 1)) as res, toTypeName(res);
|
||||
{1:1,2:1} Map(Int256,Int256)
|
||||
{1:1,2:1} Map(Int256, Int256)
|
||||
select mapPopulateSeries(map(toInt8(-10), toInt8(1), 2, 1)) as res, toTypeName(res);
|
||||
{-10:1,-9:0,-8:0,-7:0,-6:0,-5:0,-4:0,-3:0,-2:0,-1:0,0:0,1:0,2:1} Map(Int16,Int16)
|
||||
{-10:1,-9:0,-8:0,-7:0,-6:0,-5:0,-4:0,-3:0,-2:0,-1:0,0:0,1:0,2:1} Map(Int16, Int16)
|
||||
select mapPopulateSeries(map(toInt16(-10), toInt16(1), 2, 1)) as res, toTypeName(res);
|
||||
{-10:1,-9:0,-8:0,-7:0,-6:0,-5:0,-4:0,-3:0,-2:0,-1:0,0:0,1:0,2:1} Map(Int16,Int16)
|
||||
{-10:1,-9:0,-8:0,-7:0,-6:0,-5:0,-4:0,-3:0,-2:0,-1:0,0:0,1:0,2:1} Map(Int16, Int16)
|
||||
select mapPopulateSeries(map(toInt32(-10), toInt32(1), 2, 1)) as res, toTypeName(res);
|
||||
{-10:1,-9:0,-8:0,-7:0,-6:0,-5:0,-4:0,-3:0,-2:0,-1:0,0:0,1:0,2:1} Map(Int32,Int32)
|
||||
{-10:1,-9:0,-8:0,-7:0,-6:0,-5:0,-4:0,-3:0,-2:0,-1:0,0:0,1:0,2:1} Map(Int32, Int32)
|
||||
select mapPopulateSeries(map(toInt64(-10), toInt64(1), 2, 1)) as res, toTypeName(res);
|
||||
{-10:1,-9:0,-8:0,-7:0,-6:0,-5:0,-4:0,-3:0,-2:0,-1:0,0:0,1:0,2:1} Map(Int64,Int64)
|
||||
{-10:1,-9:0,-8:0,-7:0,-6:0,-5:0,-4:0,-3:0,-2:0,-1:0,0:0,1:0,2:1} Map(Int64, Int64)
|
||||
select mapPopulateSeries(map(toInt64(-10), toInt64(1), 2, 1), toInt64(-5)) as res, toTypeName(res);
|
||||
{-10:1,-9:0,-8:0,-7:0,-6:0,-5:0} Map(Int64,Int64)
|
||||
{-10:1,-9:0,-8:0,-7:0,-6:0,-5:0} Map(Int64, Int64)
|
||||
select mapPopulateSeries(); -- { serverError 42 }
|
||||
select mapPopulateSeries('asdf'); -- { serverError 43 }
|
||||
select mapPopulateSeries(map('1', 1, '2', 1)) as res, toTypeName(res); -- { serverError 43 }
|
||||
|
@ -0,0 +1 @@
|
||||
{1:2,3:4,5:6,7:8} {'2021-05-20':1,'2021-05-21':2,'2021-05-22':3,'2021-05-23':4}
|
11
tests/queries/0_stateless/02002_parse_map_int_key.sql
Normal file
11
tests/queries/0_stateless/02002_parse_map_int_key.sql
Normal file
@ -0,0 +1,11 @@
|
||||
SET allow_experimental_map_type = 1;
|
||||
|
||||
DROP TABLE IF EXISTS t_map_int_key;
|
||||
CREATE TABLE t_map_int_key (m1 Map(UInt32, UInt32), m2 Map(Date, UInt32)) ENGINE = Memory;
|
||||
|
||||
INSERT INTO t_map_int_key FORMAT CSV "{1:2, 3: 4, 5 :6, 7 : 8}","{'2021-05-20':1, '2021-05-21': 2, '2021-05-22' :3, '2021-05-23' : 4}"
|
||||
;
|
||||
|
||||
SELECT m1, m2 FROM t_map_int_key;
|
||||
|
||||
DROP TABLE t_map_int_key;
|
Loading…
Reference in New Issue
Block a user