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 │   │
└────────────┴───┴───┘
```

while (!chain.empty())
                {
                    const auto * func = chain.top();
                    chain.pop();
                    if (func->type != ActionsDAG::ActionType::FUNCTION)
                        continue;
                    if (func->children.size() == 1)
                    {
                        std::tie(out_value, out_type) = applyFunctionForFieldOfUnknownType(func->function_builder, out_type, out_value);
                    }
                    else if (func->children.size() == 2)
                    {
                        const auto * left = func->children[0];
                        const auto * right = func->children[1];
                        if (left->column && isColumnConst(*left->column))
                        {
                            auto left_arg_type = left->result_type;
                            auto left_arg_value = (*left->column)[0];
                            std::tie(out_value, out_type) = applyBinaryFunctionForFieldOfUnknownType(
                                    func->function_builder, left_arg_type, left_arg_value, out_type, out_value);
                        }
                        else
                        {
                            auto right_arg_type = right->result_type;
                            auto right_arg_value = (*right->column)[0];
                            std::tie(out_value, out_type) = applyBinaryFunctionForFieldOfUnknownType(
                                    func->function_builder, out_type, out_value, right_arg_type, right_arg_value);
                        }
                    }
                }