21.5.1
```sql

create table test(d Date, k Int64, s String) 
Engine=MergeTree partition by (toYYYYMM(d),k) order by (d, k)

insert into test values ('2020-01-01', 1, '');
insert into test values ('2020-01-02', 1, '');

SELECT * FROM test WHERE d != '2020-01-01'
0 rows in set. Elapsed: 0.003 sec.


SELECT * FROM test WHERE identity(d) !=  '2020-01-01';
┌──────────d─┬─k─┬─s─┐
│ 2020-01-02 │ 1 │   │
└────────────┴───┴───┘

SELECT * FROM test WHERE toDate(d) != '2020-01-01';
┌──────────d─┬─k─┬─s─┐
│ 2020-01-02 │ 1 │   │
└────────────┴───┴───┘
```

#include <Interpreters/Set.h>
#include <Parsers/queryToString.h>
#include <Parsers/ASTLiteral.h>
#include <Parsers/ASTSubquery.h>
#include <Parsers/ASTIdentifier.h>
#include <IO/WriteBufferFromString.h>
#include <IO/Operators.h>
#include <cassert>
#include <stack>
namespace DB
{
namespace ErrorCodes
{
    extern const int LOGICAL_ERROR;
    extern const int BAD_TYPE_OF_FIELD;
}
String Range::toString() const
{
    WriteBufferFromOwnString str;
    if (!left_bounded)
        str << "(-inf, ";
    else
        str << (left_included ? '[' : '(') << applyVisitor(FieldVisitorToString(), left) << ", ";
    if (!right_bounded)
        str << "+inf)";
    else
        str << applyVisitor(FieldVisitorToString(), right) << (right_included ? ']' : ')');
    return str.str();
}
static String extractFixedPrefixFromLikePattern(const String & like_pattern)