mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Fixed error #2795
This commit is contained in:
parent
e0dc0ccaff
commit
207a2b8b3c
@ -212,7 +212,7 @@ InterpreterSelectQuery::InterpreterSelectQuery(
|
||||
/// Calculate structure of the result.
|
||||
{
|
||||
Pipeline pipeline;
|
||||
executeImpl(pipeline, input, true);
|
||||
executeImpl(pipeline, nullptr, true);
|
||||
result_header = pipeline.firstStream()->getHeader();
|
||||
}
|
||||
}
|
||||
@ -360,9 +360,6 @@ InterpreterSelectQuery::AnalysisResult InterpreterSelectQuery::analyzeExpression
|
||||
|
||||
void InterpreterSelectQuery::executeImpl(Pipeline & pipeline, const BlockInputStreamPtr & input, bool dry_run)
|
||||
{
|
||||
if (input)
|
||||
pipeline.streams.push_back(input);
|
||||
|
||||
/** Streams of data. When the query is executed in parallel, we have several data streams.
|
||||
* If there is no GROUP BY, then perform all operations before ORDER BY and LIMIT in parallel, then
|
||||
* if there is an ORDER BY, then glue the streams using UnionBlockInputStream, and then MergeSortingBlockInputStream,
|
||||
@ -382,6 +379,9 @@ void InterpreterSelectQuery::executeImpl(Pipeline & pipeline, const BlockInputSt
|
||||
}
|
||||
else
|
||||
{
|
||||
if (input)
|
||||
pipeline.streams.push_back(input);
|
||||
|
||||
/** Read the data from Storage. from_stage - to what stage the request was completed in Storage. */
|
||||
QueryProcessingStage::Enum from_stage = executeFetchColumns(pipeline);
|
||||
|
||||
|
@ -0,0 +1,6 @@
|
||||
stest
|
||||
---
|
||||
stest
|
||||
stest
|
||||
---
|
||||
stest
|
31
dbms/tests/queries/0_stateless/00687_insert_into_mv.sql
Normal file
31
dbms/tests/queries/0_stateless/00687_insert_into_mv.sql
Normal file
@ -0,0 +1,31 @@
|
||||
DROP TABLE IF EXISTS test.test;
|
||||
DROP TABLE IF EXISTS test.mv_bad;
|
||||
DROP TABLE IF EXISTS test.mv_good;
|
||||
DROP TABLE IF EXISTS test.mv_group;
|
||||
|
||||
CREATE TABLE test.test (x String) ENGINE = Null;
|
||||
|
||||
create MATERIALIZED VIEW test.mv_bad (x String)
|
||||
ENGINE = MergeTree Partition by tuple() order by tuple()
|
||||
AS SELECT DISTINCT x FROM test.test;
|
||||
|
||||
create MATERIALIZED VIEW test.mv_good (x String)
|
||||
ENGINE = MergeTree Partition by tuple() order by tuple()
|
||||
AS SELECT x FROM test.test;
|
||||
|
||||
create MATERIALIZED VIEW test.mv_group (x String)
|
||||
ENGINE = MergeTree Partition by tuple() order by tuple()
|
||||
AS SELECT x FROM test.test group by x;
|
||||
|
||||
insert into test.test values ('stest'), ('stest');
|
||||
|
||||
select * from test.mv_bad;
|
||||
SELECT '---';
|
||||
select * from test.mv_good;
|
||||
SELECT '---';
|
||||
select * from test.mv_group;
|
||||
|
||||
DROP TABLE test.mv_bad;
|
||||
DROP TABLE test.mv_good;
|
||||
DROP TABLE test.mv_group;
|
||||
DROP TABLE test.test;
|
Loading…
Reference in New Issue
Block a user