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)
``` 
{
    if (!prepared_sets)
        return;
    auto set_key = PreparedSetKey::forSubquery(*subquery_or_table_name);
    if (prepared_sets->get(set_key))
        return; 
    if (auto set_ptr_from_storage_set = isPlainStorageSetInSubquery(subquery_or_table_name))
    {
        prepared_sets->set(set_key, set_ptr_from_storage_set);
        return;
    }
    auto interpreter_subquery = interpretSubquery(subquery_or_table_name, getContext(), {}, query_options);
    auto io = interpreter_subquery->execute();
    PullingAsyncPipelineExecutor executor(io.pipeline);
    SetPtr set = std::make_shared<Set>(settings.size_limits_for_set, true, getContext()->getSettingsRef().transform_null_in);
    set->setHeader(executor.getHeader().getColumnsWithTypeAndName());
    Block block;
    while (executor.pull(block))
    {
        if (block.rows() == 0)
            continue;
        
        if (!set->insertFromBlock(block.getColumnsWithTypeAndName()))
            return;
    }
    set->finishInsert();
    prepared_sets->set(set_key, std::move(set));
}
SetPtr ExpressionAnalyzer::isPlainStorageSetInSubquery(const ASTPtr & subquery_or_table_name)