version 21.5.5.12 (official build)

I'm trying to change data type for a column that is used in the TTL expression.
It works well when the table is empty.
When the table is not empty, the mutation fails.
As a result the table ends up in an inconsistent state.

```
create table test
(
InsertionDateTime DateTime,
TTLDays Int32 DEFAULT CAST(365, 'Int32')
)
Engine=MergeTree()
order by tuple()
TTL InsertionDateTime + toIntervalDay(TTLDays);

Ok.

insert into test values (now(), 23);

Ok.

ALTER TABLE test modify column TTLDays Int16 DEFAULT CAST(365, 'Int16');

Code: 341, e.displayText() = DB::Exception: Exception happened during execution of mutation 'mutation_2.txt' with part 'all_1_1_0' reason: 'Code: 10, e.displayText() = DB::Exception: Not found column InsertionDateTime in block. There are only columns: TTLDays (version 21.5.5.12 (official build))'. This error maybe retryable or not. In case of unretryable error, mutation can be killed with KILL MUTATION query (version 21.5.5.12 (official build)) [DB Errorcode=341]

insert into test values (now(), 23);

Ok.

select table, column, type, sum(rows) rows, sum(column_bytes_on_disk) on_disk
from system.parts_columns where column like 'TTLDays'
group by database, table, column, type

table | column  | type  | rows | on_disk
------+---------+-------+------+--------
test  | TTLDays | Int32 |    1 |      86
test  | TTLDays | Int16 |    1 |      84
```
}
            
            stages.emplace_back(context);
            for (const auto & column : unchanged_columns)
                stages.back().column_to_updated.emplace(
                    column, std::make_shared<ASTIdentifier>(column));
        }
    }
    is_prepared = true;
    return prepareInterpreterSelectQuery(stages, dry_run);
}
ASTPtr MutationsInterpreter::prepareInterpreterSelectQuery(std::vector<Stage> & prepared_stages, bool dry_run)
{
    NamesAndTypesList all_columns = metadata_snapshot->getColumns().getAllPhysical();
    
    for (size_t i = 0; i < prepared_stages.size(); ++i)
    {
        if (!prepared_stages[i].filters.empty())
        {
            for (const auto & column : all_columns)
                prepared_stages[i].output_columns.insert(column.name);
            continue;
        }
        if (i > 0)
            prepared_stages[i].output_columns = prepared_stages[i - 1].output_columns;
        if (prepared_stages[i].output_columns.size() < all_columns.size())
        {
            for (const auto & kv : prepared_stages[i].column_to_updated)
                prepared_stages[i].output_columns.insert(kv.first);
        }