
**Describe the bug**
TLPHaving of Sqlancer test

- log [link](https://clickhouse-test-reports.s3.yandex.net/22706/520f4f39eccfcc16491fbc58d9cb44856deb5f53/sqlancer_test/TLPHaving.err)
```
+ java -jar target/sqlancer-1.1.0.jar --num-threads 10 --timeout-seconds 300 --num-queries 1000 --username default --password '' clickhouse --oracle TLPHaving
+ tee /test_output/TLPHaving.out
java.lang.AssertionError: SELECT MAX(((t0.c0)=(t0.c0))), (MIN(t0.c0)) and ((- (COUNT((t0.c0) OR (t0.c0))))), t0.c0, (- (t0.c0)), MIN(t0.c0) FROM t0 GROUP BY t0.c0 HAVING MAX(((t0.c0)>(''))) UNION ALL SELECT MAX(((t0.c0)==(t0.c0))), (MIN(t0.c0)) and ((- (COUNT((t0.c0) OR (t0.c0))))), t0.c0, (- (t0.c0)), MIN(t0.c0) FROM t0 GROUP BY t0.c0 HAVING (NOT (MAX(((t0.c0)>(''))))) UNION ALL SELECT MAX(((t0.c0)=(t0.c0))), (MIN(t0.c0)) and ((- (COUNT((t0.c0) OR (t0.c0))))), t0.c0, (- (t0.c0)), MIN(t0.c0) FROM t0 GROUP BY t0.c0 HAVING ((MAX(((t0.c0)>('')))) IS NULL) SETTINGS aggregate_functions_null_for_empty=1, enable_optimize_predicate_expression=0;
	at sqlancer.common.query.SQLQueryAdapter.checkException(SQLQueryAdapter.java:100)
	at sqlancer.common.query.SQLQueryAdapter.executeAndGet(SQLQueryAdapter.java:131)
	at sqlancer.ComparatorHelper.getResultSetFirstColumnAsString(ComparatorHelper.java:54)
	at sqlancer.clickhouse.oracle.tlp.ClickHouseTLPHavingOracle.check(ClickHouseTLPHavingOracle.java:66)
	at sqlancer.ProviderAdapter.generateAndTestDatabase(ProviderAdapter.java:49)
	at sqlancer.Main$DBMSExecutor.run(Main.java:323)
	at sqlancer.Main$2.run(Main.java:507)
	at sqlancer.Main$2.runThread(Main.java:485)
	at sqlancer.Main$2.run(Main.java:475)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
	at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: ru.yandex.clickhouse.except.ClickHouseUnknownException: ClickHouse exception, code: 1002, host: localhost, port: 8123; localhost:8123 failed to respond
	at ru.yandex.clickhouse.except.ClickHouseExceptionSpecifier.getException(ClickHouseExceptionSpecifier.java:91)
	at ru.yandex.clickhouse.except.ClickHouseExceptionSpecifier.specify(ClickHouseExceptionSpecifier.java:55)
	at ru.yandex.clickhouse.except.ClickHouseExceptionSpecifier.specify(ClickHouseExceptionSpecifier.java:24)
	at ru.yandex.clickhouse.ClickHouseStatementImpl.getInputStream(ClickHouseStatementImpl.java:633)
	at ru.yandex.clickhouse.ClickHouseStatementImpl.executeQuery(ClickHouseStatementImpl.java:117)
	at ru.yandex.clickhouse.ClickHouseStatementImpl.executeQuery(ClickHouseStatementImpl.java:100)
	at ru.yandex.clickhouse.ClickHouseStatementImpl.executeQuery(ClickHouseStatementImpl.java:95)
	at ru.yandex.clickhouse.ClickHouseStatementImpl.executeQuery(ClickHouseStatementImpl.java:90)
	at sqlancer.common.query.SQLQueryAdapter.executeAndGet(SQLQueryAdapter.java:121)
	... 10 more
Caused by: org.apache.http.NoHttpResponseException: localhost:8123 failed to respond
	at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:141)
	at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56)
	at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259)
	at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163)
	at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:157)
	at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273)
	at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
	at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272)
	at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
	at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
	at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108)
	at ru.yandex.clickhouse.ClickHouseStatementImpl.getInputStream(ClickHouseStatementImpl.java:614)
	... 15 more
```
{
    checkSource(*source);
    const auto & source_header = source->getOutputs().front().getHeader();
    if (output_ports.empty())
        header = source_header;
    else
        assertBlocksHaveEqualStructure(header, source_header, "Pipes");
    if (collected_processors)
        collected_processors->emplace_back(source);
    output_ports.push_back(&source->getOutputs().front());
    processors.emplace_back(std::move(source));
    max_parallel_streams = std::max<size_t>(max_parallel_streams, output_ports.size());
}
void Pipe::addTotalsSource(ProcessorPtr source)
{
    if (output_ports.empty())
        throw Exception("Cannot add totals source to empty Pipe.", ErrorCodes::LOGICAL_ERROR);
    if (totals_port)
        throw Exception("Totals source was already added to Pipe.", ErrorCodes::LOGICAL_ERROR);
    checkSource(*source);
    const auto & source_header = output_ports.front()->getHeader();
    assertBlocksHaveEqualStructure(header, source_header, "Pipes");
    if (collected_processors)
        collected_processors->emplace_back(source);
    totals_port = &source->getOutputs().front();
    processors.emplace_back(std::move(source));
}
void Pipe::addExtremesSource(ProcessorPtr source)