**Describe the unexpected behaviour**

Not sure if it is a bug but we encounter a very strange issue when using the same field 2 times in a where clause.
Basically : field = <> and toYear(field)= <>

**How to reproduce**
* Clickhouse 20.5.2.7


Create table statement :
```
DROP TABLE IF EXISTS datasources.cal_pace_strange2;
CREATE TABLE datasources.cal_pace_strange2
(
    `htl_id` UInt32,
    `stay_date` Date,
    `snpdate` Date,
    `leadtime` String,
    `los` String,
    `mkt_id` String,
    `sob_id` String,
    `res_status_id` String,
    `rt_id` String,
    `cur` String,
    `rns` Decimal(9, 4),
    `arrivals` Decimal(9, 4),
    `departures` Decimal(9, 4),
    `adults` Decimal(9, 4),
    `children` Decimal(9, 4),
    `rm_rev` Decimal(18, 10),
    `fd_rev` Decimal(18, 10),
    `oth_rev` Decimal(18, 10),
    `tot_rev` Decimal(18, 10)

)
    ENGINE = MergeTree()
        PARTITION BY toYYYYMM(snpdate)
        ORDER BY (htl_id, stay_date, snpdate)
        SETTINGS index_granularity = 8192;
```

Load the data using the attached SQL inserts.

[data_bug_clickhouse.txt](https://github.com/ClickHouse/ClickHouse/files/4903808/data_bug_clickhouse.txt)


This query returns 0 results :

`select * from cal_pace_strange2 where snpdate='2020-06-09' and htl_id=66 and stay_date='2020-10-02' and toYear(stay_date) = 2020;`

This one return the correct results :

`select * from cal_pace_strange2 where snpdate='2020-06-09' and htl_id=66 and stay_date='2020-10-02'`

Same behavior occurs in 20.4.3 and 20.4.4

Expected behavior :

Both queries should return the same results.




const ASTPtr & node,
    size_t & out_key_column_num,
    DataTypePtr & out_key_column_type,
    std::vector<const ASTFunction *> & out_functions_chain)
{
    /** By itself, the key column can be a functional expression. for example, `intHash32(UserID)`.
      * Therefore, use the full name of the expression for search.
      */
    const auto & sample_block = key_expr->getSampleBlock();
    String name = node->getColumnName();
    auto it = key_columns.find(name);
    if (key_columns.end() != it)
    {
        out_key_column_num = it->second;
        out_key_column_type = sample_block.getByName(it->first).type;
        return true;
    }
    if (const auto * func = node->as<ASTFunction>())
    {
        const auto & args = func->arguments->children;
        if (args.size() != 1)
            return false;
        out_functions_chain.push_back(func);
        return isKeyPossiblyWrappedByMonotonicFunctionsImpl(args[0], out_key_column_num, out_key_column_type, out_functions_chain);
    }
    return false;
}
static void castValueToType(const DataTypePtr & desired_type, Field & src_value, const DataTypePtr & src_type, const ASTPtr & node)