Skip to content

Verify FixedSizeBinary FlatBuffers DType and align Serde deserializers - #12337

Open
lwwmanning wants to merge 1 commit into
developfrom
wm/fix-dtype-serde-duration-and-mask-slices
Open

lwwmanning wants to merge 1 commit into
developfrom
wm/fix-dtype-serde-duration-and-mask-slices

Conversation

@lwwmanning

@lwwmanning lwwmanning commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Fixes a regression from #12192 where files containing FixedSizeBinary columns could not be opened because the DType FlatBuffers verifier rejected FixedSizeBinary as an unknown variant. Also aligns DTypeSerde variant indices, tuple/newtype deserialization, positional record decoding, and StructFields length validation with Serialize, and extends draw_dtype to generate nested FixedSizeBinary and arbitrary non-nullable map keys across FlatBuffers, Proto, and JSON coherence tests.

Assisted by Antigravity and Devin.

@lwwmanning lwwmanning added the changelog/fix A bug fix label Nov 29, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-30T00:18:43.258937Z ece306f New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@codspeed

codspeed Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Merging this PR will improve performance by 16.79%

Warning

vortex-data has exceeded the Hobby plan limit of 5 active contributors. Upgrade your plan or apply to the open source program by December 8, 2026 to keep using CodSpeed.

2 warnings

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

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

⚡ 1 improved benchmark
✅ 2176 untouched benchmarks
⏩ 164 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
⚡ CPU Simulation varbinview_large 153.6 µs 131.5 µs +16.79%

Tip

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


Comparing wm/fix-dtype-serde-duration-and-mask-slices (3867eb7) with develop (4525dfa)

Open in CodSpeed

Footnotes

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

@lwwmanning lwwmanning left a comment

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.

Posted by Claude Opus 5.5 on Will's behalf.

Wire format note: nothing that Serialize or the FlatBuffers writer emits changes, but both readers now accept more. Will plans to review it by hand before approval.

  • vortex-array/src/dtype/serde/flatbuffers/verify.rs line 68: since #12192, from_flatbuffer runs this verifier, and it rejected FixedSizeBinary as an unknown variant. So develop cannot open any file with a FixedSizeBinary column. Please say this in the description, because it is the most important user-facing fix here.
  • vortex-array/src/dtype/serde/serde.rs lines 216 to 300: the hand-written DTypeVariant identifier visitor is what #[derive(Deserialize)] with #[serde(variant_identifier)] generates for a unit-only enum. Using the derive removes about 75 lines and the index table that must stay in step with Serialize.
  • vortex-array/src/dtype/serde/mod.rs: the removed test_serde_union_dtype_json_roundtrip pinned the exact Union JSON. The Hegel test only checks that a value roundtrips, so a change to the serialized form of Union, Map or FixedSizeBinary would still pass. The token tests pin Union only for deserialization. Please keep the Union JSON golden, or use assert_tokens for it.
  • Two removed tests, the FlatBuffers roundtrip and the nested-map JSON test, used a map keyed by a map. The draw_dtype generator only draws primitive keys (generate.rs line 69), so that case is now untested. The verifier's map key check depends on it. Drawing a non-nullable child key in draw_extended_dtype would restore it.

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Addressed all four points in f655bef:

  • Updated the PR description to lead with the Report corrupt dtypes when opening a file #12192 FixedSizeBinary FlatBuffers verifier regression.
  • Replaced the manual DTypeVariant Deserialize impl with #[derive(Deserialize)] + #[serde(variant_identifier)].
  • Restored test_serde_union_dtype_json_roundtrip and added assert_tokens coverage for FixedSizeBinary and Map.
  • Added a branch in draw_extended_dtype that draws maps with arbitrary non-nullable child keys (including nested maps).

devin-ai-integration[bot]

This comment was marked as resolved.

@lwwmanning lwwmanning left a comment

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.

Posted by Claude Opus 5.5 on Will's behalf.

Commit f655bef addresses my code points. The derived variant_identifier lists the variants in the order that Serialize numbers them, from Null at 0 to FixedSizeBinary at 13. So numeric identifiers keep their meaning. The Union JSON golden is back, and the generator now draws map keys that are not primitive. Will still plans to review the reader change by hand.

devin-ai-integration[bot]

This comment was marked as resolved.

@lwwmanning lwwmanning left a comment

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.

Posted by Claude Opus 5.5 on Will's behalf.

Commits 19f3b0b and 3867eb7 resolve the earlier review. StructFields::new already panics on a length mismatch, so the new check only turns that panic into an error and rejects nothing that Serialize writes. The positional, mismatched length and corner case tests are short and cover the new reader paths.

Will still plans to review the reader change by hand.

@lwwmanning lwwmanning left a comment

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.

Review by Gemini 4 Carbon on behalf of @lwwmanning.

Each of the three fixes here addresses a real bug—and the FixedSizeBinary FlatBuffers verifier fix in vortex-array/src/dtype/serde/flatbuffers/verify.rs resolves a regression from #12192 that currently prevents opening any file with a FixedSizeBinary column. However, bundling three unrelated changes across four crates (+1,000/-414), plus test-only additions on untouched files, makes this too broad for a single squash-merged commit and holds up the #12192 regression fix.

Remediation Plan

Please split this into three focused single-crate PRs and tighten the generator/test scope:

  1. PR 1 — vortex-array: DType FlatBuffers FixedSizeBinary verification & Serde reader alignment (vortex-array/src/dtype/serde/flatbuffers/verify.rs, flatbuffers.rs, serde.rs, mod.rs, and vortex-array/src/dtype/generate.rs):
    • Move DType::FixedSizeBinary (and arbitrary non-nullable child map keys) into draw_dtype in vortex-array/src/dtype/generate.rs instead of only drawing them at depth 0 in coherence_tests::draw_extended_dtype. That way both flatbuffers.rs and coherence_tests exercise FixedSizeBinary nested inside Struct/List/Map/Union (where lazy ViewedDType parsing runs), and draw_extended_dtype in dtype/serde/mod.rs only needs to add registered Extension dtypes on top of draw_dtype.
  2. PR 2 — vortex-arrow: Arrow Duration dictionary packing (vortex-arrow/src/executor/dictionary.rs):
    • Keep the arrow_packs_dictionary + decode_to_dictionary zero-copy Int64 reinterpretation and sparse_duration_dict_slices_repack_to_arrow_dictionary (+90/-2).
    • Drop the unrelated test-only additions in vortex-arrow/src/scalar.rs (+45) and vortex-functions/src/change_time_unit.rs (+45), where no production code changed.
  3. PR 3 — vortex-mask: Canonical slice coalescing (vortex-mask/src/lib.rs, vortex-mask/src/tests.rs):
    • Extract Mask::coalesce_slices in from_slices_unchecked and from_buffer_with_slices along with the vortex-mask/src/tests.rs updates (+69/-8).

Fixes a regression from #12192 where files containing FixedSizeBinary
columns could not be opened because the DType FlatBuffers verifier
rejected FixedSizeBinary as an unknown variant. Also aligns DTypeSerde
variant indices, tuple/newtype deserialization, positional record
decoding, and StructFields length validation with Serialize, and
extends draw_dtype to generate nested FixedSizeBinary and arbitrary
non-nullable map keys.

Co-Authored-By: Antigravity <noreply@google.com>
Signed-off-by: Will Manning <will@willmanning.io>
@lwwmanning
lwwmanning force-pushed the wm/fix-dtype-serde-duration-and-mask-slices branch from 3867eb7 to ece306f Compare November 30, 2026 00:16
@lwwmanning lwwmanning changed the title Fix DType serde, Duration dict packing, and Mask slice coalescing Verify FixedSizeBinary FlatBuffers DType and align Serde deserializers Nov 30, 2026

This branch has not been deployed

No deployments
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.

1 participant