**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.
bool hasWindow() const { return !syntax->window_function_asts.empty(); }
    bool hasGlobalSubqueries() { return has_global_subqueries; }
    bool hasTableJoin() const { return syntax->ast_join; }
    const NamesAndTypesList & aggregationKeys() const { return aggregation_keys; }
    const AggregateDescriptions & aggregates() const { return aggregate_descriptions; }
    const PreparedSets & getPreparedSets() const { return prepared_sets; }
    std::unique_ptr<QueryPlan> getJoinedPlan();
    
    const TemporaryTablesMapping & getExternalTables() const { return external_tables; }
    ActionsDAGPtr simpleSelectActions();
    
    void appendSelect(ExpressionActionsChain & chain, bool only_types);
    
    ActionsDAGPtr appendProjectResult(ExpressionActionsChain & chain) const;
private:
    StorageMetadataPtr metadata_snapshot;
    
    NameSet required_result_columns;
    SelectQueryOptions query_options;
    
    void makeSetsForIndex(const ASTPtr & node);
    JoinPtr makeTableJoin(
        const ASTTablesInSelectQueryElement & join_element,
        const ColumnsWithTypeAndName & left_sample_columns);
    const ASTSelectQuery * getAggregatingQuery() const;
    /** These methods allow you to build a chain of transformations over a block, that receives values in the desired sections of the query.
      *
      * Example usage:
      *   ExpressionActionsChain chain;
      *   analyzer.appendWhere(chain);