Skip to content

AlpRdEncodingDecoder ignores left_parts_ptype metadata, hardcodes U16 #249

Description

@dfa1

Root cause

AlpRdEncodingDecoder.java lines 53 and 107 hardcode DType.U16 for both left_parts (child 0) and patch_values (child 3). The spec (encoding-format/alp.md) defines a metadata field left_parts_ptype (proto tag 4) that names the actual width of these children.

ProtoALPRDMetadata already exposes left_parts_ptype() — the decoder just never reads it.

Impact

The Rust reference always emits u16 today, so Java/Rust round-trips are currently self-consistent. A spec-conformant writer that emits u8 left codes would be silently mis-decoded (2-byte stride over a 1-byte buffer). The Java encoder also always writes U16 (AlpRdEncodingEncoder.java:277), so our own round-trips are safe — the gap is against the broader spec.

Fix

Read meta.left_parts_ptype() in the decoder and use it for children 0 (left_parts) and 3 (patch_values) instead of hardcoding U16. At minimum, reject a non-U16 left_parts_ptype with a VortexException to fail loudly rather than silently mis-stride.

Reference

Spec: https://github.com/vortex-data/vortex/blob/mp/spec/docs/specification/encoding-format/alp.md — tag 4 left_parts_ptype.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions