Fixed error; added test from Alexander Zaitsev [#CLICKHOUSE-2]

This commit is contained in:
Alexey Milovidov 2018-03-19 17:29:40 +03:00
parent bbb12e89f0
commit 590feb02b5
4 changed files with 24 additions and 4 deletions

View File

@ -27,6 +27,7 @@ public:
bool supportsPrewhere() const override { return getTargetTable()->supportsPrewhere(); }
bool supportsFinal() const override { return getTargetTable()->supportsFinal(); }
bool supportsIndexForIn() const override { return getTargetTable()->supportsIndexForIn(); }
bool mayBenefitFromIndexForIn(const ASTPtr & left_in_operand) const override { return getTargetTable()->mayBenefitFromIndexForIn(left_in_operand); }
BlockOutputStreamPtr write(const ASTPtr & query, const Settings & settings) override;
void drop() override;

View File

@ -32,9 +32,12 @@ public:
}
std::string getTableName() const override { return table_name; }
bool supportsSampling() const override { return data.supportsSampling(); }
bool supportsFinal() const override { return data.supportsFinal(); }
bool supportsPrewhere() const override { return data.supportsPrewhere(); }
bool supportsFinal() const override { return data.supportsFinal(); }
bool supportsIndexForIn() const override { return true; }
bool mayBenefitFromIndexForIn(const ASTPtr & left_in_operand) const override { return data.mayBenefitFromIndexForIn(left_in_operand); }
const ColumnsDescription & getColumns() const override { return data.getColumns(); }
void setColumns(ColumnsDescription columns_) override { return data.setColumns(std::move(columns_)); }
@ -74,9 +77,6 @@ public:
void alter(const AlterCommands & params, const String & database_name, const String & table_name, const Context & context) override;
bool supportsIndexForIn() const override { return true; }
bool mayBenefitFromIndexForIn(const ASTPtr & left_in_operand) const override { return data.mayBenefitFromIndexForIn(left_in_operand); }
bool checkTableCanBeDropped() const override;
MergeTreeData & getData() { return data; }

View File

@ -0,0 +1,3 @@
1 2000-01-01
1 2000-01-01
1 2000-01-01

View File

@ -0,0 +1,16 @@
USE test;
DROP TABLE IF EXISTS test;
DROP TABLE IF EXISTS test_mv;
create table test (a Int8) engine=Memory;
insert into test values (1);
create materialized view test_mv Engine=MergeTree(date, (a), 8192) populate as select a, toDate('2000-01-01') date from test;
select * from test_mv; -- OK
select * from test_mv where a in (select a from test_mv); -- EMPTY (bug)
select * from ".inner.test_mv" where a in (select a from test_mv); -- OK
DROP TABLE test;
DROP TABLE test_mv;