How to reproduce:

```sql
EXPLAIN SYNTAX
SELECT x
FROM 
(
    SELECT 1 AS x
    UNION DISTINCT
    SELECT 1
)

Query id: e777bc02-5d1b-4d49-ba89-4ebe31172387


Exception on client:
Code: 32. DB::Exception: Attempt to read after eof: while receiving packet from localhost:9000

```

{
    BlockIO res;
    QueryPlan query_plan;
    buildQueryPlan(query_plan);
    auto pipeline = query_plan.buildQueryPipeline(QueryPlanOptimizationSettings(context->getSettingsRef()));
    res.pipeline = std::move(*pipeline);
    res.pipeline.addInterpreterContext(context);
    return res;
}
void InterpreterSelectWithUnionQuery::ignoreWithTotals()
{
    for (auto & interpreter : nested_interpreters)
        interpreter->ignoreWithTotals();
}
}