ClickHouse / clickhouse-java

ClickHouse Java Clients & JDBC Driver
https://clickhouse.com
Apache License 2.0
1.45k stars 535 forks source link

[client-v2] Fixes handling empty results while using reader #1845

Closed chernser closed 1 month ago

chernser commented 1 month ago

Summary

BinaryFormatReader implementation is stateful and hold current record to be accessible before calling next(). Data is provided as stream and because of this reason handling hasNext() is complex because reader should read data upfront without affect current own position to avoid skipping records. This PR fixes detecting if no data is present in data stream.

Note

There are two cases of empty result:

Closes https://github.com/ClickHouse/clickhouse-java/issues/1788

Checklist

Delete items not relevant to your PR:

sonarcloud[bot] commented 1 month ago

Quality Gate Passed Quality Gate passed

Issues
3 New issues
0 Accepted issues

Measures
0 Security Hotspots
100.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud