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

```

#include <Columns/getLeastSuperColumn.h>
#include <Interpreters/Context.h>
#include <Interpreters/InterpreterSelectQuery.h>
#include <Interpreters/InterpreterSelectWithUnionQuery.h>
#include <Parsers/ASTSelectQuery.h>
#include <Parsers/ASTSelectWithUnionQuery.h>
#include <Parsers/queryToString.h>
#include <Processors/QueryPlan/DistinctStep.h>
#include <Processors/QueryPlan/IQueryPlanStep.h>
#include <Processors/QueryPlan/QueryPlan.h>
#include <Processors/QueryPlan/UnionStep.h>
#include <Processors/QueryPlan/LimitStep.h>
#include <Processors/QueryPlan/OffsetStep.h>
#include <Common/typeid_cast.h>
#include <Interpreters/InDepthNodeVisitor.h>
#include <algorithm>
namespace DB
{
namespace ErrorCodes
{
    extern const int LOGICAL_ERROR;
    extern const int UNION_ALL_RESULT_STRUCTURES_MISMATCH;
    extern const int EXPECTED_ALL_OR_DISTINCT;
}
struct CustomizeASTSelectWithUnionQueryNormalize
{
    using TypeToVisit = ASTSelectWithUnionQuery;
    const UnionMode & union_default_mode;
    static void getSelectsFromUnionListNode(ASTPtr & ast_select, ASTs & selects)