mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 09:32:01 +00:00
impl (#44051)
This commit is contained in:
parent
e0a6ccc830
commit
3e3738bd49
@ -254,7 +254,7 @@ void ExpressionAnalyzer::analyzeAggregation(ActionsDAGPtr & temp_actions)
|
||||
auto * select_query = query->as<ASTSelectQuery>();
|
||||
|
||||
makeAggregateDescriptions(temp_actions, aggregate_descriptions);
|
||||
has_aggregation = !aggregate_descriptions.empty() || (select_query && (select_query->groupBy() || select_query->having()));
|
||||
has_aggregation = !aggregate_descriptions.empty() || (select_query && select_query->groupBy());
|
||||
|
||||
if (!has_aggregation)
|
||||
{
|
||||
@ -411,7 +411,7 @@ void ExpressionAnalyzer::analyzeAggregation(ActionsDAGPtr & temp_actions)
|
||||
if (group_asts.empty())
|
||||
{
|
||||
select_query->setExpression(ASTSelectQuery::Expression::GROUP_BY, {});
|
||||
has_aggregation = select_query->having() || !aggregate_descriptions.empty();
|
||||
has_aggregation = !aggregate_descriptions.empty();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,3 @@
|
||||
9
|
||||
100
|
||||
10
|
@ -0,0 +1,9 @@
|
||||
select number from numbers_mt(10) having number >= 9;
|
||||
|
||||
select count() from numbers_mt(100) having count() > 1;
|
||||
|
||||
select queryID() as t from numbers(10) with totals having t = initialQueryID(); -- { serverError 48 }
|
||||
|
||||
-- this query works despite 'with total' doesn't make any sense due to this logic:
|
||||
-- https://github.com/ClickHouse/ClickHouse/blob/master/src/Interpreters/InterpreterSelectQuery.cpp#L608-L610
|
||||
select count() from (select queryID() as t from remote('127.0.0.{1..3}', numbers(10)) with totals having t = initialQueryID()) settings prefer_localhost_replica = 1;
|
Loading…
Reference in New Issue
Block a user