mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Merge pull request #11495 from vzakaznikov/live_view_support_for_prewhere
Adding support for PREWHERE in live view tables.
This commit is contained in:
commit
5cc2f318c9
@ -26,6 +26,11 @@ public:
|
||||
return std::make_shared<StorageBlocks>(table_id, columns, std::move(pipes), to_stage);
|
||||
}
|
||||
std::string getName() const override { return "Blocks"; }
|
||||
/// 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; }
|
||||
|
||||
QueryProcessingStage::Enum getQueryProcessingStage(const Context &, QueryProcessingStage::Enum /*to_stage*/, const ASTPtr &) const override { return to_stage; }
|
||||
|
||||
Pipes read(
|
||||
|
@ -0,0 +1,2 @@
|
||||
5 1
|
||||
10 2
|
@ -0,0 +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) 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 PREWHERE sum_a > 5; -- { serverError 182 }
|
||||
|
||||
INSERT INTO mt VALUES (1),(2),(3);
|
||||
|
||||
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;
|
Loading…
Reference in New Issue
Block a user