Reproducer: 
``` sql
SELECT count() FROM (SELECT queryID() AS t FROM remote('127.0.0.{1..3}', numbers(10)) WITH TOTALS HAVING t = initialQueryID())

Code: 49. DB::Exception: Received from localhost:9000. DB::Exception: Chunk info was not set for chunk in GroupingAggregatedTransform.. (LOGICAL_ERROR)
``` 
{
    const auto * select_query = getAggregatingQuery();
    ExpressionActionsChain::Step & step = chain.lastStep(columns_after_join);
    for (const auto & desc : aggregate_descriptions)
        for (const auto & name : desc.argument_names)
            step.addRequiredOutput(name);
    
    
    
    GetAggregatesVisitor::Data data;
    GetAggregatesVisitor(data).visit(select_query->select());
    if (select_query->having())
        GetAggregatesVisitor(data).visit(select_query->having());
    if (select_query->orderBy())
        GetAggregatesVisitor(data).visit(select_query->orderBy());
    
    for (const ASTFunction * node : data.aggregates)
        if (node->arguments)
            for (auto & argument : node->arguments->children)
                getRootActions(argument, only_types, step.actions());
}
void SelectQueryExpressionAnalyzer::appendWindowFunctionsArguments(