Skip to content

Add selectStream methods for large result sets#323

Merged
simPod merged 2 commits into
masterfrom
claude/streaming-select
Jun 25, 2026
Merged

Add selectStream methods for large result sets#323
simPod merged 2 commits into
masterfrom
claude/streaming-select

Conversation

@simPod

@simPod simPod commented Mar 27, 2026

Copy link
Copy Markdown
Owner

Summary

Adds streaming variants for SELECT queries:

  • ClickHouseClient::selectStream()
  • ClickHouseClient::selectStreamWithParams()

Both methods return the raw PSR-7 StreamInterface response body, so callers can incrementally read large result sets instead of forcing the client to materialize and decode the complete response in memory.

Implementation

  • Reuses the existing SELECT request path and ClickHouse settings handling.
  • Keeps the existing select() / selectWithParams() behavior unchanged.
  • Leaves output decoding to callers, which lets them choose line-by-line, chunked, or format-specific streaming parsers.

Validation

  • Added coverage for streamed SELECT responses, parameterized streamed SELECTs, and streamed SELECT settings.
  • Verified locally with the SelectTest suite against ClickHouse.
  • Exercised from a downstream application with a large aggregation response to confirm reduced memory usage.

Returns raw PSR-7 StreamInterface instead of loading the full response
into memory, allowing incremental processing of large query results.

https://claude.ai/code/session_01YX19TXMGf89gacogUmxHJM
@codecov

codecov Bot commented Mar 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.41%. Comparing base (ddb1e57) to head (73797d6).
⚠️ Report is 8 commits behind head on master.

Files with missing lines Patch % Lines
src/Client/PsrClickHouseClient.php 86.66% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #323      +/-   ##
==========================================
- Coverage   94.49%   94.41%   -0.09%     
==========================================
  Files          42       42              
  Lines         709      734      +25     
==========================================
+ Hits          670      693      +23     
- Misses         39       41       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@simPod
simPod merged commit 9aeb299 into master Jun 25, 2026
17 of 19 checks passed
@simPod
simPod deleted the claude/streaming-select branch June 25, 2026 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants