```sql
CREATE TABLE dt64test
(`dt64column` DateTime64(3))
ENGINE = MergeTree
PARTITION BY toYYYYMM(dt64column)
ORDER BY dt64column;

INSERT INTO dt64test  VALUES ('2020-01-13 13:37:00');

SELECT 1 FROM dt64test WHERE dt64column = toDateTime('2020-01-13 13:37:00');
DB::Exception: Key expression contains comparison between inconvertible types: DateTime64(3) and DateTime

SELECT 1 FROM dt64test WHERE dt64column = materialize(toDateTime('2020-01-13 13:37:00'));
┌─1─┐
│ 1 │
└───┘
```
{
    if (from_type_hint && from_type_hint->equals(type))
    {
        return src;
    }
    WhichDataType which_type(type);
    WhichDataType which_from_type;
    if (from_type_hint)
    {
        which_from_type = WhichDataType(*from_type_hint);
    }
    
    if (which_type.isDate() && which_from_type.isDateTime())
    {
        return static_cast<UInt16>(static_cast<const DataTypeDateTime &>(*from_type_hint).getTimeZone().toDayNum(src.get<UInt64>()).toUnderType());
    }
    else if (which_type.isDateTime() && which_from_type.isDate())
    {
        return static_cast<const DataTypeDateTime &>(type).getTimeZone().fromDayNum(DayNum(src.get<UInt64>()));
    }
    else if (type.isValueRepresentedByNumber() && src.getType() != Field::Types::String)
    {
        if (which_type.isUInt8()) return convertNumericType<UInt8>(src, type);
        if (which_type.isUInt16()) return convertNumericType<UInt16>(src, type);
        if (which_type.isUInt32()) return convertNumericType<UInt32>(src, type);
        if (which_type.isUInt64()) return convertNumericType<UInt64>(src, type);
        if (which_type.isUInt128()) return convertNumericType<UInt128>(src, type);