https://s3.amazonaws.com/clickhouse-test-reports/0/0eaf05a2dd246fc6fee4e58ba78d3e9f51dac40c/sqlancer__release_/TLPHaving.err

```
DROP DATABASE IF EXISTS database0TLPHaving;
CREATE DATABASE IF NOT EXISTS database0TLPHaving;
USE database0TLPHaving;
CREATE TABLE database0TLPHaving.t0 (c0 String) ENGINE = Log() ;
INSERT INTO t0(c0) VALUES ('-169109851');
INSERT INTO t0(c0) VALUES ('+A');
INSERT INTO t0(c0) VALUES ('-251131989'), ('Kn5c2^mLK'), ('r?IB[mf!_');
```

Has the result
```
SELECT
    MAX(sin((410823204 + 1893374210) != -(-1976649740))),
    1102699011,
    ('-111708376' != '') + (1969336991 <= -1611144300)
FROM t0 AS t0
GROUP BY
    -251131989,
    -1154587996
SETTINGS aggregate_functions_null_for_empty = 1, enable_optimize_predicate_expression = 0, allow_experimental_analyzer = 0

┌─MAXOrNull(sin(notEquals(plus(410823204, 1893374210), negate(-1976649740))))─┬─1102699011─┬─plus(notEquals('-111708376', ''), lessOrEquals(1969336991, -1611144300))─┐
│                                                          0.8414709848078965 │ 1102699011 │                                                                        1 │
└─────────────────────────────────────────────────────────────────────────────┴────────────┴──────────────────────────────────────────────────────────────────────────┘
```

Adding `HAVING expr`, `HAVING not(expr)`, `HAVING (expr IS NULL)` has no output:

expr = `NOT cos(MAX(pow(1523598955, 763027371)))`

```
SELECT
    MAX(sin((410823204 + 1893374210) != -(-1976649740))),
    1102699011,
    ('-111708376' != '') + (1969336991 <= -1611144300)
FROM t0 AS t0
GROUP BY
    -251131989,
    -1154587996
HAVING NOT cos(MAX(pow(1523598955, 763027371)))
SETTINGS aggregate_functions_null_for_empty = 1, enable_optimize_predicate_expression = 0, allow_experimental_analyzer = 0

Query id: fb31da56-35b8-4c30-b714-59702125c2b3

Ok.

0 rows in set. Elapsed: 0.035 sec.
```

```
SELECT
    MAX(sin((410823204 + 1893374210) != -(-1976649740))),
    1102699011,
    ('-111708376' != '') + (1969336991 <= -1611144300)
FROM t0 AS t0
GROUP BY
    -251131989,
    -1154587996
HAVING NOT (NOT cos(MAX(pow(1523598955, 763027371))))
SETTINGS aggregate_functions_null_for_empty = 1, enable_optimize_predicate_expression = 0, allow_experimental_analyzer = 0

Query id: 6bb6df4a-fab8-4036-ae9b-3d109cfb8ef3

Ok.

0 rows in set. Elapsed: 0.034 sec.
```

```
SELECT
    MAX(sin((410823204 + 1893374210) != -(-1976649740))),
    1102699011,
    ('-111708376' != '') + (1969336991 <= -1611144300)
FROM t0 AS t0
GROUP BY
    -251131989,
    -1154587996
HAVING (NOT cos(MAX(pow(1523598955, 763027371)))) IS NULL
SETTINGS aggregate_functions_null_for_empty = 1, enable_optimize_predicate_expression = 0, allow_experimental_analyzer = 0

Query id: 2685f92d-a046-4dc9-8209-ab77f5d03cef

Ok.

0 rows in set. Elapsed: 0.037 sec.
```
{
    if constexpr (std::is_same_v<ToType, Int8> || std::is_same_v<ToType, UInt8>)
        return builder.getInt8Ty();
    else if constexpr (std::is_same_v<ToType, Int16> || std::is_same_v<ToType, UInt16>)
        return builder.getInt16Ty();
    else if constexpr (std::is_same_v<ToType, Int32> || std::is_same_v<ToType, UInt32>)
        return builder.getInt32Ty();
    else if constexpr (std::is_same_v<ToType, Int64> || std::is_same_v<ToType, UInt64>)
        return builder.getInt64Ty();
    else if constexpr (std::is_same_v<ToType, Float32>)
        return builder.getFloatTy();
    else if constexpr (std::is_same_v<ToType, Float64>)
        return builder.getDoubleTy();
    return nullptr;
}
template <typename Type>
static inline bool canBeNativeType()