Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why not ClickHouseBinaryFormatReader extends Iterator or Stream interface ? #1963

Open
abcfy2 opened this issue Nov 22, 2024 · 0 comments · May be fixed by #1986
Open

Why not ClickHouseBinaryFormatReader extends Iterator or Stream interface ? #1963

abcfy2 opened this issue Nov 22, 2024 · 0 comments · May be fixed by #1986

Comments

@abcfy2
Copy link

abcfy2 commented Nov 22, 2024

Describe your feedback

I think ClickHouseBinaryFormatReader should also extends Iterator or Stream interface, that will make handle large result set very easy to use Java Stream API.

Code example

Maybe this will be a use case:

QueryResponse response = this.client.query("select * from mytable").get();
ClickHouseBinaryFormatReader reader = client.newBinaryFormatReader(response);

// if ClickHouseBinaryFormatReader extends Stream, we can use
reader.map(....).filter(...)

// if ClickHouseBinaryFormatReader extends Iterator, we can use
StreamSupport.stream(Spliterators.spliteratorUnknownSize(reader, 0), false).map(...).filter(...)

Thanks.

abcfy2 added a commit to abcfy2/clickhouse-java that referenced this issue Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant