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:
SELECT 1 LIMIT 0 - has no result data but has column name and type
CREATE TABLE test - has nothing at all, so readers that expect schema before data should also handle it correctly.
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 handlinghasNext()
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:
SELECT 1 LIMIT 0
- has no result data but has column name and typeCREATE TABLE test
- has nothing at all, so readers that expect schema before data should also handle it correctly.Closes https://github.com/ClickHouse/clickhouse-java/issues/1788
Checklist
Delete items not relevant to your PR: