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.
Root cause
AlpRdEncodingDecoder.javalines 53 and 107 hardcodeDType.U16for bothleft_parts(child 0) andpatch_values(child 3). The spec (encoding-format/alp.md) defines a metadata fieldleft_parts_ptype(proto tag 4) that names the actual width of these children.ProtoALPRDMetadataalready exposesleft_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-U16left_parts_ptypewith aVortexExceptionto 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 4left_parts_ptype.