Added test with LowCardinality strings serialization.

This commit is contained in:
Nikolai Kochetov 2018-08-08 18:28:19 +03:00
parent 95c64aa5a9
commit f1c05a2192
2 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,25 @@
NativeBlockInputStream
LowCardinality(String) 123_a 2
LowCardinality(String) 123_bb 3 123_
LowCardinality(String) 123_ 1 123_a
LowCardinality(String) 123_a 2 123_bb
LowCardinality(String) 123_ccc 4 123_ccc
LowCardinality(String) 123_a 2 123_dddd
LowCardinality(String) 123_bb 3
LowCardinality(String) 123_ 1
LowCardinality(String) 123_dddd 5
-
LowCardinality(Nullable(String)) 123_a 3 \N
LowCardinality(Nullable(String)) 0
LowCardinality(Nullable(String)) 123_bb 4 123_
LowCardinality(Nullable(String)) 123_ 2 123_a
LowCardinality(Nullable(String)) 123_a 3 123_bb
LowCardinality(Nullable(String)) 0 123_ccc
LowCardinality(Nullable(String)) 123_ccc 5 123_dddd
LowCardinality(Nullable(String)) 123_a 3 \N
LowCardinality(Nullable(String)) 123_bb 4 \N
LowCardinality(Nullable(String)) 123_ 2 \N
LowCardinality(Nullable(String)) 123_dddd 6 \N
MergeTree
499500000
499999500000

View File

@ -0,0 +1,22 @@
select 'NativeBlockInputStream';
select toTypeName(dict), dict, lowCardinalityIndexes(dict), lowCardinalityKeys(dict) from (select '123_' || toLowCardinality(v) as dict from (select arrayJoin(['a', 'bb', '', 'a', 'ccc', 'a', 'bb', '', 'dddd']) as v));
select '-';
select toTypeName(dict), dict, lowCardinalityIndexes(dict), lowCardinalityKeys(dict) from (select '123_' || toLowCardinality(v) as dict from (select arrayJoin(['a', Null, 'bb', '', 'a', Null, 'ccc', 'a', 'bb', '', 'dddd']) as v));
select 'MergeTree';
drop table if exists test.lc_small_dict;
drop table if exists test.lc_big_dict;
create table test.lc_small_dict (str StringWithDictionary) engine = MergeTree order by str;
create table test.lc_big_dict (str StringWithDictionary) engine = MergeTree order by str;
insert into test.lc_small_dict select toString(number % 1000) from system.numbers limit 1000000;
select sum(toUInt64OrZero(str)) from test.lc_small_dict;
insert into test.lc_big_dict select toString(number) from system.numbers limit 1000000;
select sum(toUInt64OrZero(str)) from test.lc_big_dict;
drop table if exists test.lc_small_dict;
drop table if exists test.lc_big_dict;