Update test create table if not exists sample_prewhere

This commit is contained in:
Nikolai Kochetov 2019-09-04 19:44:25 +03:00
parent 3bd453985b
commit 0d1846baab
2 changed files with 5 additions and 17 deletions

View File

@ -1,17 +1,7 @@
drop table if exists test.sample_prewhere;
drop table if exists test.sample_prewhere_all;
create table if not exists sample_prewhere (date Date, id Int32, time Int64) engine = MergeTree partition by date order by (id, time, intHash64(time)) sample by intHash64(time);
create table if not exists test.sample_prewhere (date Date, id Int32, time Int64) engine = MergeTree partition by date order by (id, time, intHash64(time)) sample by intHash64(time);
insert into test.sample_prewhere values ('2019-01-01', 2, 1564028096);
insert into test.sample_prewhere values ('2019-01-01', 1, 1564028096);
insert into test.sample_prewhere values ('2019-01-02', 3, 1564028096);
insert into test.sample_prewhere values ('2019-01-01', 2, toDateTime('2019-07-20 00:00:01'));
insert into test.sample_prewhere values ('2019-01-01', 1, toDateTime('2019-07-20 00:00:02'));
insert into test.sample_prewhere values ('2019-01-02', 3, toDateTime('2019-07-20 00:00:03'));
create table if not exists test.sample_prewhere_all as test.sample_prewhere engine = Distributed('test_cluster_two_shards_localhost', 'test', 'sample_prewhere');
select id from test.sample_prewhere_all SAMPLE 1 where toDateTime(time) = '2019-07-20 00:00:00' limit 0, 1;
select id from test.sample_prewhere_all SAMPLE 1 where toDateTime(time) > '2019-07-20 00:00:00' limit 0, 1;
select id from test.sample_prewhere_all SAMPLE 1 where toDateTime(time) = '2019-07-20 00:00:00';
select count() from test.sample_prewhere_all SAMPLE 1 where toDateTime(time) > '2019-07-20 00:00:00' limit 0, 1;
drop table if exists test.sample_prewhere;
drop table if exists test.sample_prewhere_all;
select id from remote('127.0.0.{1,3}', currentDatabase(), sample_prewhere) SAMPLE 1 where toDateTime(time) = '2019-07-20 00:00:00';