**Describe what's wrong**

Crash on executing `alter table tbl_name materialize column col_name`. Column is `col_name Uint8`

**Does it reproduce on recent release?**

Reproducible from official Docker image version 21.11.3.6

**How to reproduce**

* 21.11.3.6
* Using CLI client

**Expected behavior**

Column is materialized

**Error message and/or stacktrace**

```
[e27227f83079] 2021.11.19 14:03:57.811793 [ 403 ] <Fatal> BaseDaemon: ########################################
[e27227f83079] 2021.11.19 14:03:57.811982 [ 403 ] <Fatal> BaseDaemon: (version 21.11.3.6 (official build), build id: 18F71364524E9B66F4365E590A43D87EF75AD9BA) (from thread 102) (query_id: 406c69fb-b639-4080-980c-0f6f69d4c1a2) Received signal Segmentation fault (11)
[e27227f83079] 2021.11.19 14:03:57.811997 [ 403 ] <Fatal> BaseDaemon: Address: NULL pointer. Access: read. Address not mapped to object.
[e27227f83079] 2021.11.19 14:03:57.812012 [ 403 ] <Fatal> BaseDaemon: Stack trace: 0x12569d28 0x12566a4d 0x1203c121 0x1203a869 0x1273d189 0x1273b113 0x130ca9f0 0x130de499 0x15d193cf 0x15d1b7c1 0x15e30169 0x15e2d8a0 0x7f862cabc609 0x7f862c9b6293
[e27227f83079] 2021.11.19 14:03:57.812217 [ 403 ] <Fatal> BaseDaemon: 2. DB::MutationsInterpreter::prepare(bool) @ 0x12569d28 in /usr/bin/clickhouse
[e27227f83079] 2021.11.19 14:03:57.812242 [ 403 ] <Fatal> BaseDaemon: 3. DB::MutationsInterpreter::MutationsInterpreter(std::__1::shared_ptr<DB::IStorage>, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, DB::MutationCommands, std::__1::shared_ptr<DB::Context const>, bool) @ 0x12566a4d in /usr/bin/clickhouse
[e27227f83079] 2021.11.19 14:03:57.812273 [ 403 ] <Fatal> BaseDaemon: 4. DB::InterpreterAlterQuery::executeToTable(DB::ASTAlterQuery const&) @ 0x1203c121 in /usr/bin/clickhouse
[e27227f83079] 2021.11.19 14:03:57.812287 [ 403 ] <Fatal> BaseDaemon: 5. DB::InterpreterAlterQuery::execute() @ 0x1203a869 in /usr/bin/clickhouse
[e27227f83079] 2021.11.19 14:03:57.812302 [ 403 ] <Fatal> BaseDaemon: 6. ? @ 0x1273d189 in /usr/bin/clickhouse
[e27227f83079] 2021.11.19 14:03:57.812316 [ 403 ] <Fatal> BaseDaemon: 7. DB::executeQuery(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::shared_ptr<DB::Context>, bool, DB::QueryProcessingStage::Enum) @ 0x1273b113 in /usr/bin/clickhouse
[e27227f83079] 2021.11.19 14:03:57.812338 [ 403 ] <Fatal> BaseDaemon: 8. DB::TCPHandler::runImpl() @ 0x130ca9f0 in /usr/bin/clickhouse
[e27227f83079] 2021.11.19 14:03:57.812349 [ 403 ] <Fatal> BaseDaemon: 9. DB::TCPHandler::run() @ 0x130de499 in /usr/bin/clickhouse
[e27227f83079] 2021.11.19 14:03:57.812366 [ 403 ] <Fatal> BaseDaemon: 10. Poco::Net::TCPServerConnection::start() @ 0x15d193cf in /usr/bin/clickhouse
[e27227f83079] 2021.11.19 14:03:57.812377 [ 403 ] <Fatal> BaseDaemon: 11. Poco::Net::TCPServerDispatcher::run() @ 0x15d1b7c1 in /usr/bin/clickhouse
[e27227f83079] 2021.11.19 14:03:57.812388 [ 403 ] <Fatal> BaseDaemon: 12. Poco::PooledThread::run() @ 0x15e30169 in /usr/bin/clickhouse
[e27227f83079] 2021.11.19 14:03:57.812400 [ 403 ] <Fatal> BaseDaemon: 13. Poco::ThreadImpl::runnableEntry(void*) @ 0x15e2d8a0 in /usr/bin/clickhouse
[e27227f83079] 2021.11.19 14:03:57.812411 [ 403 ] <Fatal> BaseDaemon: 14. start_thread @ 0x9609 in /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
[e27227f83079] 2021.11.19 14:03:57.812425 [ 403 ] <Fatal> BaseDaemon: 15. clone @ 0x122293 in /usr/lib/x86_64-linux-gnu/libc-2.31.so
[e27227f83079] 2021.11.19 14:03:57.934476 [ 403 ] <Fatal> BaseDaemon: Checksum of the binary: 9911BB0CC38DE5BCDEC7F55FCCAACC88, integrity check passed.
```

**Additional context**

> Add any other context about the problem here.

{
        auto & stage = prepared_stages[i];
        ASTPtr all_asts = std::make_shared<ASTExpressionList>();
        for (const auto & ast : stage.filters)
            all_asts->children.push_back(ast);
        for (const auto & kv : stage.column_to_updated)
            all_asts->children.push_back(kv.second);
        
        for (const String & column : stage.output_columns)
            all_asts->children.push_back(std::make_shared<ASTIdentifier>(column));
        
        
        bool execute_scalar_subqueries = !dry_run;
        auto syntax_result = TreeRewriter(context).analyze(
            all_asts, all_columns, storage, metadata_snapshot, false, true, execute_scalar_subqueries);
        if (execute_scalar_subqueries && context->hasQueryContext())
            for (const auto & it : syntax_result->getScalars())
                context->getQueryContext()->addScalar(it.first, it.second);
        stage.analyzer = std::make_unique<ExpressionAnalyzer>(all_asts, syntax_result, context);
        ExpressionActionsChain & actions_chain = stage.expressions_chain;
        for (const auto & ast : stage.filters)
        {
            if (!actions_chain.steps.empty())
                actions_chain.addStep();
            stage.analyzer->appendExpression(actions_chain, ast, dry_run);
            stage.filter_column_names.push_back(ast->getColumnName());
        }
        if (!stage.column_to_updated.empty())
        {
            if (!actions_chain.steps.empty())