diff --git a/dbms/tests/queries/0_stateless/00688_low_cardinality_serialization.reference b/dbms/tests/queries/0_stateless/00688_low_cardinality_serialization.reference new file mode 100644 index 00000000000..46293993c01 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00688_low_cardinality_serialization.reference @@ -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 diff --git a/dbms/tests/queries/0_stateless/00688_low_cardinality_serialization.sql b/dbms/tests/queries/0_stateless/00688_low_cardinality_serialization.sql new file mode 100644 index 00000000000..e45fc69cd2b --- /dev/null +++ b/dbms/tests/queries/0_stateless/00688_low_cardinality_serialization.sql @@ -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; +