You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(results): cap SELECT result rows (default 500) with a 100/500/1k/5k/10k selector
A normal SELECT no longer pulls every row over the wire — it fetches at most a
selected cap (default 500). Hybrid mechanism per #86: ClickHouse stops cleanly
server-side (`max_result_rows` + `result_overflow_mode='break'`), and a small
client-side guard in `applyStreamLine` trims the block-boundary overage `break`
can leave, flagging `result.capped`.
- `src/state.js` — `KEYS.resultRowLimit` + `resultRowLimit` (default 500, read
from localStorage), `RESULT_ROW_LIMIT_OPTIONS`, and a pure `normalizeRowLimit`
that snaps a stored/selected value back to a known option.
- `src/net/ch-client.js` — `runQuery` honors `o.resultRowLimit`, adding the cap
params via the existing `extra` dict. Scope is decided by the caller (app.js
passes 0 for EXPLAIN/PIPELINE/ESTIMATE, which also run as `Table` and so can't
be told apart by format here).
- `src/core/stream.js` — `newResult(fmt, rowLimit=0)` carries the cap + `capped`;
`applyStreamLine` stops pushing past the cap and flags `capped`. Pure, 100%.
- `src/ui/results.js` — a row-limit `<select>` after the view tabs (hidden for
EXPLAIN), a "first N (capped)" badge in the stats row, and the display cap now
follows the limit (`visCap`) so 10000 renders 10000 instead of the old 5000.
- `src/ui/app.js` — `setResultRowLimit` (persist pref + re-run so a raise fetches
more), and the run path passes the cap for normal SELECTs only.
Tests added in the same change (state/stream/net/results) — per-file 100% gate
holds; build clean; e2e green on Chromium/Firefox/WebKit. Reconciles CHANGELOG
[Unreleased]. ADR-0001 unaffected (`resultRowLimit` is a plain field like
theme/density, not a signal).
Closes#86. Part of #68 (Phase 2).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0 commit comments