**Describe the bug**
Under certain conditions the equals comparison between String and Date yields the wrong result. Range Comparisons with greather-than-equals returns the correct result set.

**How to reproduce**
* Which ClickHouse server version to use: 21.2.5.5 (latest at the time of this issue)
* Which interface to use, if matters: HTTP (but should not matter)

```sql
CREATE TABLE default.myTable (
	myDay Date,
	myOrder Int32,
	someData String
) 
ENGINE = ReplacingMergeTree
PARTITION BY floor(toYYYYMMDD(myDay), -1)
ORDER BY (myOrder)
;

INSERT INTO default.myTable (myDay, myOrder) VALUES ('2021-01-01', 1);
INSERT INTO default.myTable (myDay, myOrder) VALUES ('2021-01-02', 2); // This row should be returned
INSERT INTO default.myTable (myDay, myOrder) VALUES ('2021-01-03', 3);

SELECT * FROM default.myTable mt
WHERE myDay = '2021-01-02';
```

**Expected behavior**
The last query in the example should yield the marked row. Instead it returns a empty result set.

There must be a connection to the used `PARTITION KEY`. The issue fails to reproduce as soon as I do any changes to the `PARTITION KEY` setting.

{
    
    if (field.isExplicit())
        return applyFunctionForField(func, current_type, field);
    String result_name = "_" + func->getName() + "_" + toString(field.column_idx);
    const auto & columns = field.columns;
    size_t result_idx = columns->size();
    for (size_t i = 0; i < result_idx; ++i)
    {
        if ((*columns)[i].name == result_name)
            result_idx = i;
    }
    ColumnsWithTypeAndName args{(*columns)[field.column_idx]};
    if (result_idx == columns->size())
    {
        field.columns->emplace_back(ColumnWithTypeAndName {nullptr, func->getResultType(), result_name});
        (*columns)[result_idx].column = func->execute(args, (*columns)[result_idx].type, columns->front().column->size());
    }
    return {field.columns, field.row_idx, result_idx};
}
void KeyCondition::traverseAST(const ASTPtr & node, ContextPtr context, Block & block_with_constants)