CynicDog opened a new issue, #9984: URL: https://github.com/apache/arrow-rs/issues/9984
**Is your feature request related to a problem or challenge?** `parquet/src/arrow/schema/primitive.rs::from_fixed_len_byte_array` carries a long-standing TODO from PR #1682: ```rust // TODO: This should check the type length for the decimal and interval types ``` `PrimitiveTypeBuilder::build()` enforces `type_length` constraints at construction (`schema/types.rs:477` for INTERVAL, `:565-580` for DECIMAL precision-vs-length), but schemas decoded directly from Thrift skip that path. The reader-side conversion currently produces an Arrow type that does not match the on-disk layout when: - `DECIMAL` has `type_length` outside `1..=32` — silently routes through `Decimal128` / `Decimal256` with bogus inputs. - `INTERVAL` has `type_length != 12` — silently returns `Interval(DayTime)` regardless. The same function already handles `FLOAT16` correctly: it returns an error when `type_length != 2`. **Describe the solution you'd like** In `from_fixed_len_byte_array`, validate `type_length` mirroring the existing FLOAT16 pattern: - `DECIMAL` (logical and converted): require `1 <= type_length <= 32` (Decimal128 fits within 16 bytes; Decimal256 up to 32). - `INTERVAL` converted type: require `type_length == 12` per the Parquet format spec. Return `ParquetError::General` with a clear message stating the expected range/value and the actual value. **Describe alternatives you've considered** - Replicating the builder's fuller precision-vs-length check on the reader side. Rejected: that duplicates `PrimitiveTypeBuilder::check_decimal_precision_scale` and broadens scope. Length-range validation alone catches the cases that produce a wrong Arrow type. - Doing nothing and letting downstream Arrow construction fail later. Rejected: errors would surface far from the cause and harder to diagnose. **Additional context** - Source: `parquet/src/arrow/schema/primitive.rs:316` - TODO introduced in PR #1682 (Fix Parquet Arrow Schema Inference) - Builder-side checks already present at `schema/types.rs:477` (INTERVAL) and `:565-580` (DECIMAL precision-vs-length). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
