Skip to content

Progress bar: cap at 99% until the query actually finishes - #10

Merged
wudidapaopao merged 4 commits into
mainfrom
fix-progress-cap
Jul 1, 2026
Merged

wudidapaopao merged 4 commits into
mainfrom
fix-progress-cap

Conversation

@wudidapaopao

@wudidapaopao wudidapaopao commented Jul 1, 2026 •

Copy link
Copy Markdown
Collaborator

For a remote-source query like SELECT * FROM s3('…trips_0.gz', NOSIGN, 'TabSeparatedWithNames') LIMIT 10,
the progress bar jumped to 100% immediately but the result only appeared ~3s later.

Cause: the bar's percentage is readRows / totalRowsToRead. For url/s3 the rows are read
quickly, but the real time goes into downloading + decompressing the remote file — work the
rows metric doesn't capture. So the bar showed 100% while the query kept running.

Fix: cap the displayed percentage at 99% while the query is running. Actual completion
is signalled by the progress line being removed and the result rendering. The Elapsed
time was already correct (it's the real download time — not a bug).

🤖 Generated with Claude Code

Note

Cap SQL query progress bar at 99% until query completes and add spinner animation

  • The progress bar percent is now non-decreasing and capped at 99% during execution, only reaching 100% when the query actually finishes.
  • A spinner animation updates on a 100ms timer between engine ticks, keeping the progress line alive even when no new progress events arrive.
  • Rate values (rows/s, bytes/s) are frozen to the last received tick to avoid drift between ticks.
  • Adds a GitHub icon link to the header using a generalized .icon-btn CSS selector that works on anchor elements in addition to buttons.

Macroscope summarized 8cf4079.

For remote sources (url/s3), readRows reaches totalRowsToRead well before the
download+decompress finishes, so the rows-based percentage jumped to 100% while the
query kept running for seconds — looking done but stuck. Cap the displayed percentage
at 99% while running; completion is conveyed by the progress line being removed and the
result appearing.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
chdb-wasm Ready Ready Preview, Comment Jul 1, 2026 8:51am

Request Review

Add a GitHub mark icon (inline SVG) linking to https://github.com/chdb-io/chdb, opening
in a new tab. Styled as an .icon-btn next to the theme toggle; the selector was widened
from button.icon-btn to .icon-btn so an <a> picks up the same styling.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Comment thread web/index.html
- progressBar uses Math.floor so a capped 99% leaves an empty cell (Math.round(29.7)
  rendered a full 30-cell bar, making 99% still look "done").
- Repaint the progress line on a 100ms timer, not only on engine ticks. Some queries
  (e.g. a remote url/s3 download) emit one tick then go quiet, freezing the line; the
  timer advances a braille spinner at the end so it stays visibly alive. rows/bytes/%
  keep the last engine values; the rate uses the last tick's elapsed so it doesn't drift.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Some url/s3 reads report totalRowsToRead>0 for a few ticks (bar reaches 99%) then report
0 in later ticks, which made the bar appear and then disappear, leaving only the spinner.
Latch the percentage: once a total is known, remember it (non-decreasing, capped at 99%)
and keep rendering the bar even when later ticks report no total. Queries that never report
a total still show just the spinner.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@wudidapaopao
wudidapaopao merged commit 90f052b into main Jul 1, 2026
5 checks passed

This branch was successfully deployed

1 active deployment
Preview — 8cf4079e Deployed Jul 1, 2026 by vercel[bot]
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.

1 participant