Skip to content

feat(javascript)!: bump rquickjs to 0.12 and bundle big.js as BigDecimal - #163

Draft
yuhao-su wants to merge 1 commit into
arrow-udf:mainfrom
yuhao-su:yuhao/bump-rquickjs-0.12
Draft

feat(javascript)!: bump rquickjs to 0.12 and bundle big.js as BigDecimal#163
yuhao-su wants to merge 1 commit into
arrow-udf:mainfrom
yuhao-su:yuhao/bump-rquickjs-0.12

Conversation

@yuhao-su

@yuhao-su yuhao-su commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Parked. Not targeted at the next release (0.10): the decimal contract change is breaking for JavaScript UDF authors and will be scheduled separately. Kept as a draft so the migration is ready when it is.

Closes #162.

Why

rquickjs-core 0.6.2 no longer compiles on nightly (never type stabilized in rust-lang/rust#155499, stable in 1.100), and no later rquickjs has the QuickJS BigDecimal the JavaScript runtime maps decimals to: 0.7 strips the bignum extensions, 0.9 switches the engine to quickjs-ng. So the bump has to redefine the decimal contract.

What changed

  • rquickjs 0.6 → 0.12 (quickjs-ng). API: AsyncContext::full replaces the removed Base intrinsic; Response derives JsLifetime; the deprecated async_with! becomes async_with(async |ctx| …) — most of the mod.rs diff is the reindentation that causes.
  • Breaking: decimals are big.js v7.0.1 objects (vendored verbatim under src/javascript/bigdecimal/, MIT), exposed as the global BigDecimal. BigDecimal("1.5"), toString(), toFixed/toPrecision keep working; arithmetic is add/sub/mul/div/cmp/…; valueOf throws so a + b / a < b fail loudly instead of concatenating strings or comparing references. typeof is "object"; toString() never uses exponent notation.
  • Decimal output goes through toFixed(scale): Decimal128/256 results are rounded half-up to the column scale (previously truncated), rejected if they exceed the column precision (previously stored out of range: 1234.56 into Decimal128(5, 2) read back as 123.45), and values in (-1, 0) keep their sign (the old parser turned -0.05 into 0.05).
  • README type table + Decimal section, CHANGELOG.

Verification

cargo test --features javascript: 41/41, fetch 9/9 (stable 1.91); cargo +nightly check on 1.100 clean; clippy -D warnings, fmt, and cargo +nightly doc --cfg docsrs clean (one pre-existing private-link warning). No existing test expectation had to change for quickjs-ng.

Downstream: RisingWave's e2e_test/udf/tests/language_specific/javascript.slt asserts typeof decimal === "bigdecimal" and will need "object" when it picks this up.

🤖 Generated with Claude Code

…imal`

rquickjs 0.6 no longer compiles since Rust 1.100 changed the never type
fallback, and every later release drops the QuickJS bignum extensions
(0.7 strips them, 0.9 switches the engine to quickjs-ng), so the
`BigDecimal` the JavaScript runtime maps decimals to no longer exists.

The runtime now evaluates big.js v7.0.1 (MIT) into every context and
exposes it as the global `BigDecimal`. Construction, `toString` and
`toFixed`/`toPrecision` keep working; arithmetic moves to methods, and
`valueOf` throws so `a + b` fails loudly instead of concatenating
strings.

Decimal output goes through `toFixed(scale)`: results are rounded
half-up to the column scale instead of truncated, values exceeding the
column precision are rejected instead of stored out of range, and
values in (-1, 0) keep their sign, which the old parser dropped.

API changes for 0.12: `AsyncContext::full` replaces the removed `Base`
intrinsic, `#[rquickjs::class]` types derive `JsLifetime`, and the
deprecated `async_with!` macro becomes `async_with(async |ctx| ..)`.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@yuhao-su
yuhao-su force-pushed the yuhao/bump-rquickjs-0.12 branch from 2545b0a to 261766c Compare September 3, 2026 01: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.

javascript: rquickjs 0.9+ switches to quickjs-ng, which has no BigDecimal

1 participant