**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.

{
    /** Functions < > = != <= >= in `notIn`, where one argument is a constant, and the other is one of columns of key,
      *  or itself, wrapped in a chain of possibly-monotonic functions,
      *  or constant expression - number.
      */
    Field const_value;
    DataTypePtr const_type;
    if (const auto * func = node->as<ASTFunction>())
    {
        const ASTs & args = func->arguments->children;
        DataTypePtr key_expr_type;    
        size_t key_column_num = -1;   
        MonotonicFunctionsChain chain;
        std::string func_name = func->name;
        if (atom_map.find(func_name) == std::end(atom_map))
            return false;
        if (args.size() == 1)
        {
            if (!(isKeyPossiblyWrappedByMonotonicFunctions(args[0], context, key_column_num, key_expr_type, chain)))
                return false;
            if (key_column_num == static_cast<size_t>(-1))
                throw Exception("`key_column_num` wasn't initialized. It is a bug.", ErrorCodes::LOGICAL_ERROR);
        }
        else if (args.size() == 2)
        {
            size_t key_arg_pos;           
            bool is_set_const = false;
            bool is_constant_transformed = false;