mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Update test create table if not exists sample_prewhere
This commit is contained in:
parent
3bd453985b
commit
0d1846baab
@ -1,2 +0,0 @@
|
||||
3
|
||||
6
|
@ -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';
|
||||
|
Loading…
Reference in New Issue
Block a user