**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 (select.where() && select.prewhere())
            filter_query = makeASTFunction("and", select.where(), select.prewhere());
        else
            filter_query = select.where() ? select.where() : select.prewhere();
        /** When non-strictly monotonic functions are employed in functional index (e.g. ORDER BY toStartOfHour(dateTime)),
          * the use of NOT operator in predicate will result in the indexing algorithm leave out some data.
          * This is caused by rewriting in KeyCondition::tryParseAtomFromAST of relational operators to less strict
          * when parsing the AST into internal RPN representation.
          * To overcome the problem, before parsing the AST we transform it to its semantically equivalent form where all NOT's
          * are pushed down and applied (when possible) to leaf nodes.
          */
        traverseAST(cloneASTWithInversionPushDown(filter_query), context, block_with_constants);
    }
    else
    {
        rpn.emplace_back(RPNElement::FUNCTION_UNKNOWN);
    }
}
bool KeyCondition::addCondition(const String & column, const Range & range)
{
    if (!key_columns.count(column))
        return false;
    rpn.emplace_back(RPNElement::FUNCTION_IN_RANGE, key_columns[column], range);
    rpn.emplace_back(RPNElement::FUNCTION_AND);
    return true;
}
/** Computes value of constant expression and its data type.
  * Returns false, if expression isn't constant.
  */
bool KeyCondition::getConstant(const ASTPtr & expr, Block & block_with_constants, Field & out_value, DataTypePtr & out_type)