Skip to content

Cast bool scalars to primitive types - #11171

Merged
connortsui20 merged 4 commits into
developfrom
mk/bool-scalar-cast
Nov 3, 2026
Merged

connortsui20 merged 4 commits into
developfrom
mk/bool-scalar-cast

Conversation

@mhk197

@mhk197 mhk197 commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Scalar::cast now casts booleans to primitive types (true → 1, false → 0), matching the bool array cast.

It used to reject them, so array casts that cast a scalar failed. For example, a Sparse<bool> cast to f64 errored on its fill value.

Signed-off-by: Matt Katz <mhkatz97@gmail.com>
@mhk197 mhk197 added the changelog/fix A bug fix label Nov 3, 2026
Signed-off-by: Matt Katz <mhkatz97@gmail.com>
@codspeed

codspeed Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Merging this PR will regress 1 benchmark

1 warning

⚠️ Walltime results may be unreliable

Some benchmarks used the Walltime instrument outside CodSpeed Macro Runners, which can make the results inconsistent.

Learn more about Macro Runners

See affected benchmarks

⚡ 5 improved benchmarks
❌ 1 regressed benchmark
✅ 1876 untouched benchmarks
⏩ 469 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ Walltime compare_u64_avx2 3.3 µs 3.6 µs -10.04%
⚡ CPU Simulation bench_compare_varbin[(50000, 2)] 162.3 µs 133.1 µs +21.96%
⚡ CPU Simulation take_filter_primitive_small_uncached_random_mask_random_indices[4096, 10] 24.6 µs 21.5 µs +14.61%
⚡ CPU Simulation bench_compare_sliced_dict_varbinview[(1000, 10000)] 90.5 µs 79.1 µs +14.37%
⚡ CPU Simulation bench_compare_sliced_dict_varbinview[(9999, 10000)] 233.4 µs 205.9 µs +13.36%
⚡ Walltime add_i64_nullable_neon 18.6 µs 16.5 µs +12.5%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing mk/bool-scalar-cast (c6566dc) with develop (e59b236)

Open in CodSpeed

Footnotes

  1. 469 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. ↩

Signed-off-by: Matt Katz <mhkatz97@gmail.com>
}

#[test]
fn test_cast_bool_sparse_to_f64() -> vortex_error::VortexResult<()> {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regression test

Signed-off-by: Matt Katz <mhkatz97@gmail.com>
@connortsui20
connortsui20 self-requested a review November 3, 2026 19:03

@connortsui20 connortsui20 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@connortsui20
connortsui20 enabled auto-merge (squash) November 3, 2026 19:04
@connortsui20
connortsui20 merged commit 1ec5a1b into develop Nov 3, 2026
75 of 77 checks passed
@connortsui20
connortsui20 deleted the mk/bool-scalar-cast branch November 3, 2026 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/fix A bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants