From 0d1846baab5db83c8d77c1d4d3bbab4f9591b285 Mon Sep 17 00:00:00 2001 From: Nikolai Kochetov Date: Wed, 4 Sep 2019 19:44:25 +0300 Subject: [PATCH] Update test create table if not exists sample_prewhere --- .../00975_sample_prewhere.reference | 2 -- .../0_stateless/00975_sample_prewhere.sql | 20 +++++-------------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/dbms/tests/queries/0_stateless/00975_sample_prewhere.reference b/dbms/tests/queries/0_stateless/00975_sample_prewhere.reference index 2559e5c49e7..e69de29bb2d 100644 --- a/dbms/tests/queries/0_stateless/00975_sample_prewhere.reference +++ b/dbms/tests/queries/0_stateless/00975_sample_prewhere.reference @@ -1,2 +0,0 @@ -3 -6 diff --git a/dbms/tests/queries/0_stateless/00975_sample_prewhere.sql b/dbms/tests/queries/0_stateless/00975_sample_prewhere.sql index 5d202a9d12c..3feb793c629 100644 --- a/dbms/tests/queries/0_stateless/00975_sample_prewhere.sql +++ b/dbms/tests/queries/0_stateless/00975_sample_prewhere.sql @@ -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';