mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 08:02:02 +00:00
Analyzer subquery in JOIN TREE with aggregation
This commit is contained in:
parent
cca2620c44
commit
583c65d377
@ -5527,9 +5527,15 @@ void QueryAnalyzer::resolveQuery(const QueryTreeNodePtr & query_node, Identifier
|
||||
* 3. Check that there are no columns that are not specified in GROUP BY keys.
|
||||
* 4. Validate GROUP BY modifiers.
|
||||
*/
|
||||
assertNoAggregateFunctionNodes(query_node_typed.getJoinTree(), "in JOIN TREE");
|
||||
assertNoGroupingFunction(query_node_typed.getJoinTree(), "in JOIN TREE");
|
||||
assertNoWindowFunctionNodes(query_node_typed.getJoinTree(), "in JOIN TREE");
|
||||
auto join_tree_node_type = query_node_typed.getJoinTree()->getNodeType();
|
||||
bool join_tree_is_subquery = join_tree_node_type == QueryTreeNodeType::QUERY || join_tree_node_type == QueryTreeNodeType::UNION;
|
||||
|
||||
if (!join_tree_is_subquery)
|
||||
{
|
||||
assertNoAggregateFunctionNodes(query_node_typed.getJoinTree(), "in JOIN TREE");
|
||||
assertNoGroupingFunction(query_node_typed.getJoinTree(), "in JOIN TREE");
|
||||
assertNoWindowFunctionNodes(query_node_typed.getJoinTree(), "in JOIN TREE");
|
||||
}
|
||||
|
||||
if (query_node_typed.hasWhere())
|
||||
{
|
||||
|
@ -0,0 +1,3 @@
|
||||
45
|
||||
--
|
||||
45
|
@ -0,0 +1,7 @@
|
||||
SET allow_experimental_analyzer = 1;
|
||||
|
||||
WITH subquery AS (SELECT sum(number) FROM numbers(10)) SELECT * FROM subquery;
|
||||
|
||||
SELECT '--';
|
||||
|
||||
WITH subquery AS (SELECT sum(number) FROM numbers(10)) SELECT (SELECT * FROM subquery);
|
Loading…
Reference in New Issue
Block a user