From 5fe67c429264614e1a199aeba162421e05fb345d Mon Sep 17 00:00:00 2001 From: Vitaliy Zakaznikov Date: Mon, 8 Jun 2020 13:12:40 +0200 Subject: [PATCH] * 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. --- src/Storages/LiveView/StorageLiveView.h | 1 - .../00973_live_view_select_prewhere.reference | 2 -- .../0_stateless/00973_live_view_select_prewhere.sql | 12 +++++++++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Storages/LiveView/StorageLiveView.h b/src/Storages/LiveView/StorageLiveView.h index 85e3d0cee62..fe62de224da 100644 --- a/src/Storages/LiveView/StorageLiveView.h +++ b/src/Storages/LiveView/StorageLiveView.h @@ -65,7 +65,6 @@ public: ASTPtr getInnerBlocksQuery(); /// It is passed inside the query and solved at its level. - bool supportsPrewhere() const override { return true; } bool supportsSampling() const override { return true; } bool supportsFinal() const override { return true; } diff --git a/tests/queries/0_stateless/00973_live_view_select_prewhere.reference b/tests/queries/0_stateless/00973_live_view_select_prewhere.reference index a2a88e78c97..3a6fe59ae6d 100644 --- a/tests/queries/0_stateless/00973_live_view_select_prewhere.reference +++ b/tests/queries/0_stateless/00973_live_view_select_prewhere.reference @@ -1,4 +1,2 @@ 5 1 -5 1 -10 2 10 2 diff --git a/tests/queries/0_stateless/00973_live_view_select_prewhere.sql b/tests/queries/0_stateless/00973_live_view_select_prewhere.sql index e0e2d342f9e..df3b7cb505a 100644 --- a/tests/queries/0_stateless/00973_live_view_select_prewhere.sql +++ b/tests/queries/0_stateless/00973_live_view_select_prewhere.sql @@ -1,20 +1,26 @@ SET allow_experimental_live_view = 1; DROP TABLE IF EXISTS lv; +DROP TABLE IF EXISTS lv2; DROP TABLE IF EXISTS mt; 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); 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); 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 lv2; DROP TABLE mt;