Skip to content

refactor: support formatting of bound expressions - #9228

Merged
joseph-isaacs merged 1 commit into
developfrom
ji/bound-expression-display
Aug 6, 2026
Merged

refactor: support formatting of bound expressions#9228
joseph-isaacs merged 1 commit into
developfrom
ji/bound-expression-display

Conversation

@joseph-isaacs

@joseph-isaacs joseph-isaacs commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

What

  • add an ExprDisplay interface shared by Expression and BoundExpression
  • add ScalarFnVTable::fmt_sql_display and migrate built-in formatters to it
  • format bound expressions directly instead of rebuilding an unbound tree

Why

Bound-expression consumers need compact SQL-style formatting without calling unbind(). Keeping the existing fmt_sql(&Expression, ...) method avoids a source-breaking signature change for external scalar-function vtables.

Break

Update the fmt function on scalar fns.

@codspeed-hq

codspeed-hq Bot commented Aug 6, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 14.47%

⚡ 1 improved benchmark
✅ 1900 untouched benchmarks
⏩ 43 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation decompress[u64, (1000, 16)] 74 µs 64.7 µs +14.47%

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing ji/bound-expression-display (14313eb) with develop (3f83ee9)

Open in CodSpeed

Footnotes

  1. 43 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@joseph-isaacs joseph-isaacs added the changelog/skip Do not list PR in the changelog label Aug 6, 2026
@joseph-isaacs
joseph-isaacs force-pushed the ji/bound-expression-display branch 3 times, most recently from 3e24e3c to 8a859c2 Compare August 6, 2026 12:40
@joseph-isaacs joseph-isaacs added changelog/break A breaking API change and removed changelog/skip Do not list PR in the changelog labels Aug 6, 2026
@joseph-isaacs joseph-isaacs changed the title refactor: format bound expressions without unbinding refactor: support formatting of bound expressions Aug 6, 2026
Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
@joseph-isaacs
joseph-isaacs force-pushed the ji/bound-expression-display branch from 8a859c2 to 14313eb Compare August 6, 2026 13:10
@joseph-isaacs
joseph-isaacs marked this pull request as ready for review August 6, 2026 13:11
@joseph-isaacs
joseph-isaacs merged commit 0053f78 into develop Aug 6, 2026
87 of 89 checks passed
@joseph-isaacs
joseph-isaacs deleted the ji/bound-expression-display branch August 6, 2026 13:34
connortsui20 pushed a commit that referenced this pull request Aug 6, 2026
Brings `develop` through #9228. Three files conflicted, all under
`scalar_fn/fns/binary/numeric/`, because #9210 optimized the
very kernels this branch replaced with the row framework.

`primitive.rs` keeps this branch's version. #9210 arrived independently at the
same design, and its four `mul_failure` bodies are identical to this branch's
width for width: the evidence is the discarded high half of the widened product,
so the lane never compares and LLVM cannot fold the check into
`llvm.umul.with.overflow`. What `develop` keeps and the row path does not need is
`CHECKED_VALUE_LOOP`, `DIV_CHECKS_IN_VALUE_LOOP`, `div_checked` and
`CheckedPrimitiveOp::checked`, which exist to choose between its split and
early-exit lane kernels; a row kernel produces the value and the evidence in one
pass and has no choice to make. `develop`'s named intermediates in the signed
64-bit body are adopted.

`checked.rs` takes `develop`'s `checked_lanes`, including its rewritten docs and
the relaxation from `#[inline(always)]` to `#[inline]`. `checked_apply_lanes` and
the `Failure` trait beside it are dropped: the split value/evidence pass they
served is now `CheckedSink`, and decimal, their only other neighbour, uses
`checked_lanes` alone.

`tests.rs` takes both sides. #9210's `test_multiply_overflow_boundaries` drives
`execute_numeric` end to end rather than the kernels directly, so its 20 cases
cross-check the row path against `develop`'s intent at every overflow boundary of
every width formula. They pass unmodified.

`NUMERIC_ROWFN_PLAN.md` is corrected for what this does to its benchmark table,
which it had already predicted: the unsigned multiply rows compared the row
framework against a defect `develop` has now fixed, so they are not a `RowFn` win
and the re-measurement they asked for is now like-for-like.

Verification: 3355 vortex-array, 179 vortex-tensor and 241 vortex-geo tests, 73
doctests, clippy over those three plus vortex-compute with `--all-targets
--all-features`, nightly fmt, `git diff --check`, and builds of vortex-file,
vortex-datafusion, vortex-layout, vortex-scan, vortex-compute and
vortex-btrblocks. `lance-bench` and `vortex-nvcomp` do not build in this
environment: `protoc` and CUDA are absent, on `develop` as well.

Signed-off-by: "Connor Tsui" <connor@spiraldb.com>

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014mwiAahcxc5xBfTrhDK11L
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/break A breaking API change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants