ClickHouse/dbms/tests/queries/0_stateless/01030_incorrect_count_summing_merge_tree.sql

42 lines
1.5 KiB
MySQL
Raw Normal View History

2019-11-19 14:29:52 +00:00
drop table if exists tst;
create table tst (timestamp DateTime, val Nullable(Int8)) engine SummingMergeTree partition by toYYYYMM(timestamp) ORDER by (timestamp);
insert into tst values ('2018-02-01 00:00:00', 1), ('2018-02-02 00:00:00', 2);
select count() from tst;
select count() from tst final;
select count() from tst where timestamp is not null;
select count() from tst final where timestamp is not null;
select count() from tst where val is not null;
select count() from tst final where val is not null;
select count() from tst final where timestamp>0;
select count() from tst final prewhere timestamp > 0;
select count() from tst final where timestamp > '2017-01-01 00:00:00'
select count() from tst final where val>0;
select count() from tst final prewhere val>0;
drop table if exists tst;
create table tst (timestamp DateTime, val Int8) engine SummingMergeTree partition by toYYYYMM(timestamp) ORDER by (timestamp);
insert into tst values ('2018-02-01 00:00:00', 1), ('2018-02-02 00:00:00', 2);
select count() from tst;
select count() from tst final;
select count() from tst where timestamp is not null;
select count() from tst final where timestamp is not null;
select count() from tst where val is not null;
select count() from tst final where val is not null;
select count() from tst final where timestamp>0;
select count() from tst final prewhere timestamp > 0;
select count() from tst final where timestamp > '2017-01-01 00:00:00'
select count() from tst final where val>0;
select count() from tst final prewhere val>0;
drop table tst;