mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 08:40:50 +00:00
ISSUES-320 fix rewrite expression for union all
This commit is contained in:
parent
257e973337
commit
054777a5ab
@ -95,7 +95,8 @@ void InterpreterSelectQuery::init(const BlockInputStreamPtr & input, const Names
|
||||
ASTSelectQuery & head_query = static_cast<ASTSelectQuery &>(*head);
|
||||
tail = head_query.next_union_all;
|
||||
|
||||
interpreter->next_select_in_union_all = std::make_unique<InterpreterSelectQuery>(head, context, to_stage, subquery_depth);
|
||||
interpreter->next_select_in_union_all = std::make_unique<InterpreterSelectQuery>(
|
||||
head, context, required_column_names, to_stage, subquery_depth);
|
||||
interpreter = interpreter->next_select_in_union_all.get();
|
||||
}
|
||||
}
|
||||
@ -118,10 +119,10 @@ void InterpreterSelectQuery::init(const BlockInputStreamPtr & input, const Names
|
||||
}
|
||||
else
|
||||
{
|
||||
renameColumns();
|
||||
if (!required_column_names.empty())
|
||||
rewriteExpressionList(required_column_names);
|
||||
|
||||
renameColumns();
|
||||
basicInit(input);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,4 @@
|
||||
test_string 2
|
||||
test_string 2
|
||||
test_string
|
||||
test_string
|
@ -0,0 +1,10 @@
|
||||
DROP TABLE IF EXISTS test.test;
|
||||
|
||||
CREATE TABLE test.test ( s String, i Int64) ENGINE = Memory;
|
||||
|
||||
INSERT INTO test.test VALUES('test_string', 1);
|
||||
|
||||
SELECT s, SUM(i*2) AS i FROM test.test GROUP BY s UNION ALL SELECT s, SUM(i*2) AS i FROM test.test GROUP BY s;
|
||||
SELECT s FROM (SELECT s, SUM(i*2) AS i FROM test.test GROUP BY s UNION ALL SELECT s, SUM(i*2) AS i FROM test.test GROUP BY s);
|
||||
|
||||
DROP TABLE IF EXISTS test.test;
|
Loading…
Reference in New Issue
Block a user