Skip to content

[ABA-23] test(vortex-array): repro for integer arith panics#17

Open
abnobdoss wants to merge 1 commit into
developfrom
fix/aba-23-integer-arith-panic
Open

[ABA-23] test(vortex-array): repro for integer arith panics#17
abnobdoss wants to merge 1 commit into
developfrom
fix/aba-23-integer-arith-panic

Conversation

@abnobdoss
Copy link
Copy Markdown
Owner

Summary

  • Adds 5 inline repro tests in vortex-array/src/scalar_fn/fns/binary/numeric.rs (scalar_fn::fns::binary::numeric::tests) documenting the ABA-23 integer arithmetic panic bug.
  • 4 tests are #[ignore] + #[should_panic(expected = "to_canonical failed")] — they lock the current wrong behaviour (panics on i32 add overflow, i64 div-by-zero, u32 sub underflow, i32 mul overflow).
  • 1 test (issue_aba23_to_canonical_returns_err_not_panic_on_overflow) is always green: confirms to_canonical() (the VortexResult path) returns Err gracefully; only to_primitive() converts that Err to a panic via vortex_expect.

Linear: https://linear.app/abanoubdoss/issue/ABA-23

REPRO-ONLY PR — no fix included. The fix requires a cross-operator overflow-semantics decision.

Root cause (confirmed on develop)

ToCanonical::to_primitive() at canonical.rs:489-492 calls to_canonical().vortex_expect("to_canonical failed"). Arrow arithmetic kernels return Err on integer overflow/div-by-zero but evaluation is lazy — the error surfaces inside to_canonical where vortex_expect converts it to an unrecoverable panic. Callers cannot catch with VortexResult.

Open question — semantics decision needed

  1. Return Errto_primitive() propagates VortexResult; breaking API change. Matches Operator::Add doc.
  2. Saturate — clamp to T::MAX/T::MIN. Silent but predictable.
  3. Wrap — modular arithmetic. The numeric.rs:68 comment says "wrapping" but Arrow errors, not wraps.

Should this follow Arrow's checked_* convention universally, or be per-operator configurable?

Test plan

  • cargo test -p vortex-array --lib scalar_fn::fns::binary::numeric::tests — 4 ignored, 1 green
  • -- --include-ignored — all 5 pass (4 should_panic confirmed, 1 green)
  • cargo +stable fmt -p vortex-array
  • No regressions in existing mod test subtests

🤖 Generated with Claude Code

…verflow / div-by-zero

Add 5 inline repro tests in `scalar_fn::fns::binary::numeric::tests`:
- 4 `#[ignore]` + `#[should_panic]` tests locking the current wrong behaviour
  (i32 add overflow, i64 div-by-zero, u32 sub underflow, i32 mul overflow —
  all panic via `to_primitive()` -> `vortex_expect("to_canonical failed")`).
- 1 always-green test confirming `to_canonical()` (the VortexResult path)
  returns `Err` gracefully rather than panicking.

Root cause: `ToCanonical::to_primitive()` (canonical.rs:489-492) calls
`to_canonical().vortex_expect(...)`, converting any Arrow arithmetic `Err`
into a process-aborting panic that callers cannot catch as `VortexResult`.

Fixes: https://linear.app/abanoubdoss/issue/ABA-23

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Abanoub Doss <abanoub.doss@gmail.com>
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