* Removing supportsPrewhere() from StorageLiveView.h as it is not valid.

* Updating test to check using PREWHERE in query against live view table.
* Updating test to check using PREWHERE in the stored query against the table that does
  not support PREWHWERE.
This commit is contained in:
Vitaliy Zakaznikov 2020-06-08 13:12:40 +02:00
parent 75c97ca82a
commit 5fe67c4292
3 changed files with 9 additions and 6 deletions

View File

@ -65,7 +65,6 @@ public:
ASTPtr getInnerBlocksQuery(); ASTPtr getInnerBlocksQuery();
/// It is passed inside the query and solved at its level. /// It is passed inside the query and solved at its level.
bool supportsPrewhere() const override { return true; }
bool supportsSampling() const override { return true; } bool supportsSampling() const override { return true; }
bool supportsFinal() const override { return true; } bool supportsFinal() const override { return true; }

View File

@ -1,4 +1,2 @@
5 1 5 1
5 1
10 2
10 2 10 2

View File

@ -1,20 +1,26 @@
SET allow_experimental_live_view = 1; SET allow_experimental_live_view = 1;
DROP TABLE IF EXISTS lv; DROP TABLE IF EXISTS lv;
DROP TABLE IF EXISTS lv2;
DROP TABLE IF EXISTS mt; DROP TABLE IF EXISTS mt;
CREATE TABLE mt (a Int32) Engine=MergeTree order by tuple(); CREATE TABLE mt (a Int32) Engine=MergeTree order by tuple();
CREATE LIVE VIEW lv AS SELECT sum(a) FROM mt PREWHERE a > 1; CREATE LIVE VIEW lv AS SELECT sum(a) AS sum_a FROM mt PREWHERE a > 1;
CREATE LIVE VIEW lv2 AS SELECT sum(number) AS sum_number FROM system.numbers PREWHERE number > 1;
INSERT INTO mt VALUES (1),(2),(3); INSERT INTO mt VALUES (1),(2),(3);
SELECT *,_version FROM lv; SELECT *,_version FROM lv;
SELECT *,_version FROM lv; SELECT *,_version FROM lv PREWHERE sum_a > 5; -- { serverError 182 }
INSERT INTO mt VALUES (1),(2),(3); INSERT INTO mt VALUES (1),(2),(3);
SELECT *,_version FROM lv; SELECT *,_version FROM lv;
SELECT *,_version FROM lv; SELECT *,_version FROM lv PREWHERE sum_a > 10; -- { serverError 182 }
SELECT *,_version FROM lv2; -- { serverError 182 }
SELECT *,_version FROM lv2 PREWHERE sum_number > 10; -- { serverError 182 }
DROP TABLE lv; DROP TABLE lv;
DROP TABLE lv2;
DROP TABLE mt; DROP TABLE mt;