Skip to content

Widen dictionary codes in Dict::fill_null - #10806

Merged
robert3005 merged 1 commit into
vortex-data:developfrom
ump45nose:fix/10804-widen-dict-fill-codes
Oct 26, 2026
Merged

robert3005 merged 1 commit into
vortex-data:developfrom
ump45nose:fix/10804-widen-dict-fill-codes

Conversation

@ump45nose

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #10745, as suggested in review there. When the fill value already exists in the dictionary values but its index does not fit the codes type (e.g. u8 codes and the fill value at index 300), the Dict fill_null kernel returned None, so the generic path decoded the whole array before filling. The kernel only rewrites the null codes, so it can widen them instead and keep the result dictionary-encoded.

Changes

  • For nullable codes whose type cannot hold the fill index, cast the codes to PType::min_unsigned_ptype_for_value(fill_index) (kept nullable) and then fill the nulls with the index. Codes are never negative, so the cast keeps every code. Codes that already fit and non-nullable codes take the same path as before.
  • New test fill_unreferenced_value_widens_codes calls the kernel directly and checks that it returns a Dict with widened, non-nullable codes and the right values, for u8 -> u16 (256, 300), i8 -> u8 (128), i8 -> u16 (256) and u16 -> u32 (65536). All five cases fail on develop, where the kernel returns None.

Tested with cargo test -p vortex-array --lib (4437 passed), cargo clippy -p vortex-array --all-targets --all-features -- -D warnings, and cargo +nightly-2026-09-10 fmt -p vortex-array.

AI assistance: I used an AI coding assistant to help write this change and the description; I reviewed the code and ran the tests above myself.

When the fill value is in the dictionary values but its index does not
fit the codes type, the Dict fill_null kernel declined and the generic
path decoded the whole array. Since the kernel only rewrites the null
codes, cast the codes to the smallest unsigned type that holds the fill
index and keep the result dictionary-encoded instead.

Signed-off-by: Vincent <[email protected]>
@robert3005 robert3005 added the changelog/performance A performance improvement label Oct 26, 2026
@robert3005
robert3005 merged commit 0d4ddfb into vortex-data:develop Oct 26, 2026
105 of 107 checks passed
@codspeed

codspeed Bot commented Oct 26, 2026

Copy link
Copy Markdown

Merging this PR will regress 1 benchmark

4 warnings, 1 note

⚠️ 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

⚠️ Unable to measure the execution of 2 benchmarks

These benchmarks measured no execution time, so their results are not comparable and count as unchanged. This usually happens when the compiler removes the code under test.

Prevent compiler optimizations

See affected benchmarks

⚠️ 25 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

⚠️ Base and head ran on different runner types

Some benchmarks with significant performance changes were compared across different runner types, so the changes might not come from the code. Run base and head on the same runner type, or use CodSpeed Macro Runners for more stable results.

Learn more about Macro Runners

Open the report in CodSpeed to investigate

ℹ️ 40 benchmarks have no flamegraph

The flamegraph wasn't generated: the symbols of the profiling trace could not be resolved, because no information about the language frames was collected.

See affected benchmarks

⚡ 1 improved benchmark
❌ 1 regressed benchmark
✅ 2406 untouched benchmarks
⏩ 12 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ Walltime bitpack_blocked_compress_avx2 6.7 µs 7.6 µs -11.87%
⚡ CPU Simulation filter_powerlaw_by_random[250000] 175.3 µs 131.8 µs +33.02%

Tip

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


Comparing ump45nose:fix/10804-widen-dict-fill-codes (2c715e8) with develop (dcb4f50)

Open in CodSpeed

Footnotes

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/performance A performance improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants