-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
enhancementAny new improvement worthy of a entry in the changelogAny new improvement worthy of a entry in the changelogparquetChanges to the parquet crateChanges to the parquet crate
Description
This is a follow on from #7878
Per the spec, VariantList and VariantMetadata must have offsets encoded in monotonically increasing order.
We currently do this here:
arrow-rs/parquet-variant/src/variant/list.rs
Lines 222 to 230 in 387490a
| // Validate offsets are in-bounds and monotonically increasing. | |
| // Since shallow verification checks whether the first and last offsets are in-bounds, | |
| // we can also verify all offsets are in-bounds by checking if offsets are monotonically increasing. | |
| let are_offsets_monotonic = offsets.is_sorted_by(|a, b| a < b); | |
| if !are_offsets_monotonic { | |
| return Err(ArrowError::InvalidArgumentError( | |
| "offsets are not monotonically increasing".to_string(), | |
| )); | |
| } |
and
arrow-rs/parquet-variant/src/variant/metadata.rs
Lines 240 to 248 in 387490a
| // Validate offsets are in-bounds and monotonically increasing. | |
| // Since shallow validation ensures the first and last offsets are in bounds, we can also verify all offsets | |
| // are in-bounds by checking if offsets are monotonically increasing. | |
| let are_offsets_monotonic = offsets.is_sorted_by(|a, b| a < b); | |
| if !are_offsets_monotonic { | |
| return Err(ArrowError::InvalidArgumentError( | |
| "offsets not monotonically increasing".to_string(), | |
| )); | |
| } |
Since we later loop over these offsets to access elements in the respective buffers, any non-monotonic offset range would err when accessing elements.
Metadata
Metadata
Assignees
Labels
enhancementAny new improvement worthy of a entry in the changelogAny new improvement worthy of a entry in the changelogparquetChanges to the parquet crateChanges to the parquet crate