Repository navigation
Decode stored DecimalType and PType values strictly - #10755
Conversation
Merging this PR will degrade performance by 11.33%4 warnings, 1 note
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
ee89dc6 to
d5116b9
Compare
d5116b9 to
26cd657
Compare
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
957e9ea to
07368ee
Compare
| dict_len: u32, | ||
| #[prost(uint32, repeated, tag = "3")] | ||
| dict: Vec<u32>, | ||
| #[prost(enumeration = "PType", tag = "4")] |
There was a problem hiding this comment.
So in general I think we don't want to do this anymore
Depends on #10755. ## Summary Public metadata fields expose the stored layout as Rust API and let callers bypass typed accessors. Restrict them to the owning crate while preserving the encoded metadata. ## Changes Add getters for CUDA’s Zstd metadata and a constructor and CRS getter for spatial callers. The TUI uses the existing flat-layout accessor. Internal struct literals and metadata golden files stay unchanged. Formatting and clippy passed. Tests passed apart from `chunked_input_with_mixed_dimensions_returns_error`, which fails identically on the base. GPU tests were skipped without `nvcc`. ## API Changes Metadata fields are now `pub(crate)`. Direct field access and struct literals from other crates no longer compile. Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
Summary
Prost decodes an enum value it does not know as the first variant, so a stored
DecimalTypeorPTypeoutside its enum silently reads asI8orU8. The reader then decodes the buffer or child at the wrong width, which either fails later with an unrelated error or returns wrong values. Readers need to reject such values before a later release adds a variant, such as a wider integerPType. The read path for old decimal arrays in #10701 also depends on the storedvalues_type, because it compares that width with the canonical width.Changes
Each metadata struct with one of these fields gets a
get_<field>()accessor that returns an error naming the field and the raw value, anddeserializecalls it before reading any buffer or child. The protobuf dtype decoder does the same throughpb::PType::try_from. Files from current writers read as before, andcompat.py check --mode allpasses against every published fixture.The handwritten enum fields use
prost(int32), so prost no longer generates lenient enum getters or setters. The protobuf tags and encoded bytes stay the same.For review, read the commits one at a time.
API Changes
Removes the generated enum getters and setters from the affected handwritten metadata structs. Decoding uses the strict
get_<field>()methods.🤖 Generated with Claude Code