Skip to content

playground: load ICU and JSON from the site before any SQL runs - #151

Merged
kvlonge merged 1 commit into
mainfrom
website/playground-icu
Nov 7, 2026
Merged

kvlonge merged 1 commit into
mainfrom
website/playground-icu

Conversation

@kvlonge

@kvlonge kvlonge commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

The playground's Run stage failed on queries native DuckDB 2.0 runs, such as WHERE ordered_at >= DATEADD(day, -30, CURRENT_DATE).

Cause. DuckDB-WASM 1.33.1-dev114.0 starts without ICU. The first statement that calls an ICU function (current_date(), timezone(), …) autoloads ICU while it binds, and ICU's new overloads for +, - and date_diff corrupt the binder's lookups. The result is garbled binder errors or memory access out of bounds, depending on statement order.

Change.

  • playground.js loads ICU, and json for the sample schema's JSON column, right after connecting and before any fixture or user SQL. If either fails, the Run stage says DuckDB did not load: the icu extension did not load: … with Try again.
  • prepare_playground.mjs vendors both extension files for this exact DuckDB-WASM version, pinned by sha256, at playground/duckdb/1.33.1-dev114.0/extensions/v2.0.0/wasm_eh/. The page sets custom_extension_repository to that site path, so it never fetches from extensions.duckdb.org. Sizes: icu 1,900,643 bytes (696 KB gzip), json 1,026,764 bytes (243 KB gzip), well within GitHub Pages' 100 MB per-file limit. The existing immutable cache rule for /playground/duckdb/* covers them.
  • The engine tests run each case in a fresh DuckDB, loaded as the page loads it, so an earlier case can't load ICU for a later one. New regression cases: last-30-days DATEADD, DATEDIFF against CURRENT_DATE, and month-end and leap-day DATEADD. Without the LOAD, the new test fails with Binder Error: No function matches … '(DATE, INTERVAL)'.
  • The preview-limit message from playground: say when the in-browser DuckDB, not the translation, failed #150 stays as the backstop for real gaps in the WASM build.

Checked. npm run -s test:engine: 14 pass. Build and link check: 17 pages, 0 broken links. In Chromium with extensions.duckdb.org blocked, a cold load of the last-30-days query passes all four stages (0 rows, DuckDB v2.0.0), and no extension request leaves the site. All six example chips still stop where their labels say. With the ICU file removed, the Run stage shows the load error.

The DuckDB-WASM build the playground serves starts without ICU. The first
statement that calls an ICU function, such as current_date(), autoloads it
while that statement binds, and ICU's new overloads for +, - and date_diff
corrupt the binder's lookups: garbled binder errors or "memory access out
of bounds" for queries native DuckDB 2.0 runs, such as
DATEADD(day, -30, CURRENT_DATE).

The page now loads ICU, and json for the sample schema's JSON column, right
after connecting, and says so when either fails to load. prepare_playground
vendors both extension files for this DuckDB-WASM version, pinned by
sha256, under the versioned duckdb directory, so the page never fetches
from extensions.duckdb.org.

The engine tests run each case in a fresh DuckDB loaded as the page loads
it, so an earlier case can no longer load ICU for a later one, and cover
last-30-days DATEADD, DATEDIFF against CURRENT_DATE and month-end DATEADD.
@kvlonge
kvlonge merged commit 0fcc4ce into main Nov 7, 2026
2 checks passed
@kvlonge
kvlonge deleted the website/playground-icu branch November 9, 2026 21:32

This branch was successfully deployed

No deployments
github-pages — 0fcc4ce3 Deployed Nov 7, 2026 by kvlonge via Deploy to GitHub Pages #181
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