**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.
{
    if (auto * table = analyzed_join->joined_storage.get())
        if (auto * storage_join = dynamic_cast<StorageJoin *>(table))
            return storage_join->getJoinLocked(analyzed_join);
    return {};
}
static ActionsDAGPtr createJoinedBlockActions(ContextPtr context, const TableJoin & analyzed_join)
{
    ASTPtr expression_list = analyzed_join.rightKeysList();
    auto syntax_result = TreeRewriter(context).analyze(expression_list, analyzed_join.columnsFromJoinedTable());
    return ExpressionAnalyzer(expression_list, syntax_result, context).getActionsDAG(true, false);
}
static bool allowDictJoin(StoragePtr joined_storage, ContextPtr context, String & dict_name, String & key_name)
{
    if (!joined_storage->isDictionary())
        return false;
    StorageDictionary & storage_dictionary = static_cast<StorageDictionary &>(*joined_storage);
    dict_name = storage_dictionary.getDictionaryName();
    auto dictionary = context->getExternalDictionariesLoader().getDictionary(dict_name, context);
    if (!dictionary)
        return false;
    const DictionaryStructure & structure = dictionary->getStructure();
    if (structure.id)
    {
        key_name = structure.id->name;
        return true;
    }
    return false;
}
static std::shared_ptr<IJoin> makeJoin(std::shared_ptr<TableJoin> analyzed_join, const Block & sample_block, ContextPtr context)