**Describe the bug**
https://clickhouse-test-reports.s3.yandex.net/19387/fb268ec339aeb2cbab0df5137ead3efb8374cc32/fuzzer_debug/server.log

**How to reproduce**
```
SELECT avg(diff) FROM (SELECT * FROM (SELECT learnerHash, passed - eventTime AS diff FROM statements GLOBAL SEMI LEFT JOIN (SELECT learnerHash, argMax(eventTime, resultScoreRaw) AS passed FROM (SELECT learnerHash, eventTime, resultScoreRaw FROM statements WHERE (courseId = 1) AND (onCourse = 1048575) AND (verb = 'http://adlnet.gov/expapi/verbs/passed') AND (objectId = 'https://crmm.ru/xapi/courses/spp/1/1/0-1') ORDER BY eventTime ASC) GROUP BY learnerHash) USING (learnerHash) WHERE resultScoreRaw AND (courseId = 1) AND (onCourse = 0) AND (verb = 'http://adlnet.gov/expapi/verbs/interacted') AND (eventTime <= passed) AND (diff > 0) ORDER BY eventTime DESC LIMIT 0 BY learnerHash) ORDER BY diff DESC LIMIT 7, 126)
```

Looks like query is based on `00586_removing_unused_columns_from_subquery.sql`.

MergeTreeBaseSelectProcessor.cpp:331

```
            auto & ctn = block.getByName(prewhere_info->prewhere_column_name);
            ctn.column = ctn.type->createColumnConst(block.rows(), 1u)->convertToFullColumnIfConst();
```

Looks like `prewhere_column_name` has type Float64.
for (auto & pr : required_columns_with_aliases)
            original_right_columns.push_back(pr.first);
        /** For GLOBAL JOINs (in the case, for example, of the push method for executing GLOBAL subqueries), the following occurs
            * - in the addExternalStorage function, the JOIN (SELECT ...) subquery is replaced with JOIN _data1,
            *   in the subquery_for_set object this subquery is exposed as source and the temporary table _data1 as the `table`.
            * - this function shows the expression JOIN _data1.
            */
        auto interpreter = interpretSubquery(join_element.table_expression, getContext(), original_right_columns, query_options);
        {
            joined_plan = std::make_unique<QueryPlan>();
            interpreter->buildQueryPlan(*joined_plan);
            auto sample_block = interpreter->getSampleBlock();
            auto rename_dag = std::make_unique<ActionsDAG>(sample_block.getColumnsWithTypeAndName());
            for (const auto & name_with_alias : required_columns_with_aliases)
            {
                if (sample_block.has(name_with_alias.first))
                {
                    auto pos = sample_block.getPositionByName(name_with_alias.first);
                    const auto & alias = rename_dag->addAlias(*rename_dag->getInputs()[pos], name_with_alias.second);
                    rename_dag->getIndex()[pos] = &alias;
                }
            }
            auto rename_step = std::make_unique<ExpressionStep>(joined_plan->getCurrentDataStream(), std::move(rename_dag));
            rename_step->setStepDescription("Rename joined columns");
            joined_plan->addStep(std::move(rename_step));
        }
        auto joined_actions_step = std::make_unique<ExpressionStep>(joined_plan->getCurrentDataStream(), std::move(joined_block_actions));
        joined_actions_step->setStepDescription("Joined actions");
        joined_plan->addStep(std::move(joined_actions_step));
        const ColumnsWithTypeAndName & right_sample_columns = joined_plan->getCurrentDataStream().header.getColumnsWithTypeAndName();