Skip to content

Compress wide decimals into lower parts when the writer permits the v2 format - #9759

Draft
mhk197 wants to merge 1 commit into
mk/edition-aware-schemesfrom
mk/dbp-v2
Draft

mhk197 wants to merge 1 commit into
mk/edition-aware-schemesfrom
mk/dbp-v2

Conversation

@mhk197

@mhk197 mhk197 commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Compress wide decimals into lower parts when the writer may emit vortex.decimal_byte_parts.v2. Under every current edition nothing changes, since none permits that format yet.

This is the last layer of the stack: #9834 (the array and its two wire formats) → #9928 (the compressor hands schemes the writer's permitted serialized IDs) → this PR.

Changes

DecimalScheme stays one scheme. It declares vortex.decimal_byte_parts as the format it always writes, since values that fit one signed part always serialize that way. In compress it narrows the decimal, splits it with split_decimal, and checks one thing before going further: if the split produced lower parts and the compression context does not permit the v2 format, the wide values are left canonical. Otherwise the most significant part and each lower part are compressed as children and assembled into a DecimalBytePartsArray.

The scheme now declares four children, the MSP plus up to three lower parts, so child indices are stable across both paths. MAX_LOWER_PARTS becomes public for that.

Behavior

Writer permits Narrow values Wide values
v1 only, every edition today single-part array, written as v1 canonical decimal
v1 and v2 single-part array, written as v1 MSP plus lower parts, written as v2
unrestricted, editions disabled same as above same as above

Golden and trace snapshots are unchanged. A narrow decimal follows exactly the path it did before, since splitting a value that fits one part reuses its buffer as the MSP.

Testing

  • Scheme tests: wide i128 and i256 inputs, nullable and not, split into one and three lower parts when v2 is permitted, and stay canonical when it is not. Narrow values never get lower parts and keep the frozen format under either mode. Extreme i256 values round-trip. Canonicalizing compressed output keeps the storage width. The scheme is present exactly when the frozen format is permitted, whatever the v2 setting.
  • Writer tests: a struct of wide i128 and nullable i256 columns round-trips through a file when the session permits both formats. Under the core edition a pre-split input comes back canonical, and with v2 permitted its lower parts survive.

Follow-ups

  • The CUDA preset needs to deny the v2 format, since the GPU kernel rejects lower parts. Today no edition permits v2 so the preset is safe, but that should land before one does.
  • Edition placement for vortex.decimal_byte_parts.v2.

@mhk197 mhk197 changed the title Wide decimals in DecimalByteParts, serialized as vortex.decimal_byte_parts_v2 behind preview2026.09.0 Wide decimals in DecimalByteParts Sep 3, 2026
@mhk197
mhk197 marked this pull request as draft September 3, 2026 18:40
@codspeed

codspeed Bot commented Sep 3, 2026

Copy link
Copy Markdown

Merging this PR will regress 1 benchmark

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 6 improved benchmarks
❌ 1 regressed benchmark
✅ 2246 untouched benchmarks
⏩ 218 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation decompress[u64, (4000, 1024)] 71.7 µs 87.6 µs -18.14%
WallTime arrow_checked_add_u32_neon[16384] 20.3 µs 12.9 µs +57.95%
Simulation take_filter_list_slice_mask_sequential_indices[768, 50] 184 µs 141.8 µs +29.78%
Simulation take_filter_list_slice_mask_sequential_indices[256, 50] 185.4 µs 143.3 µs +29.32%
Simulation compact[(1024, 90)] 1.4 µs 1.3 µs +12.98%
Simulation compact[(2048, 90)] 1.5 µs 1.3 µs +12.4%
Simulation allocate_drop_arrow[0] 516.4 ns 462.3 ns +11.72%

Tip

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


Comparing mk/dbp-v2 (78415c2) with mk/edition-aware-schemes (97cbf22)2

Open in CodSpeed

Footnotes

  1. 218 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.

  2. No successful run was found on mk/edition-aware-schemes (d3526b5) during the generation of this report, so 7a50318 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@mhk197 mhk197 changed the title Wide decimals in DecimalByteParts Support wide decimals in DecimalByteParts Sep 4, 2026
@mhk197 mhk197 changed the title Support wide decimals in DecimalByteParts Wide decimals in DecimalByteParts, serialized as vortex.decimal_byte_parts_v2 Sep 4, 2026
@mhk197 mhk197 changed the title Wide decimals in DecimalByteParts, serialized as vortex.decimal_byte_parts_v2 Support wide decimals in DecimalByteParts and guarantee compat with editions Sep 4, 2026
@mhk197
mhk197 force-pushed the mk/dbp-v2 branch 2 times, most recently from 35300e3 to c48b00b Compare September 8, 2026 15:10
@mhk197
mhk197 changed the base branch from develop to mk/compressor-serialized-ids September 8, 2026 15:17
@mhk197
mhk197 force-pushed the mk/dbp-v2 branch 3 times, most recently from 3d1237a to fc7f432 Compare September 8, 2026 20:35
@mhk197 mhk197 changed the title Support wide decimals in DecimalByteParts and guarantee compat with editions Compress wide decimals when the writer permits the v2 format Sep 8, 2026
@mhk197
mhk197 changed the base branch from mk/compressor-serialized-ids to mk/dbp-serde September 8, 2026 20:38
@mhk197
mhk197 force-pushed the mk/dbp-v2 branch 2 times, most recently from 416873c to 2c4016d Compare September 9, 2026 03:46
@mhk197
mhk197 removed this pull request from stack #9811 September 9, 2026 15:09
@mhk197
mhk197 changed the base branch from mk/dbp-serde to mk/compressor-serialized-ids September 9, 2026 15:09
@mhk197
mhk197 added this pull request to stack #9813 September 9, 2026 15:09
@mhk197 mhk197 changed the title Compress wide decimals when the writer permits the v2 format Compress wide decimals into lower parts when the writer permits the v2 format Sep 17, 2026
@mhk197
mhk197 removed this pull request from stack #9813 September 17, 2026 15:48
@mhk197
mhk197 changed the base branch from mk/compressor-serialized-ids to mk/edition-aware-schemes September 17, 2026 15:49
@mhk197
mhk197 added this pull request to stack #9933 September 17, 2026 15:49
…2 format

Signed-off-by: Matt Katz <mhkatz97@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