jorgecarleitao / arrow2

Transmute-free Rust library to work with the Arrow format
Apache License 2.0
1.07k stars 223 forks source link

Fixed bug in mmap of empty FixedSizeBinaryArray #1454

Closed andy-thomason closed 1 year ago

andy-thomason commented 1 year ago

This PR fixes #1453

When mmap'ing a FixedSizeBinaryArray, the length in bytes was miscalculated.

This was only used for a check, but to avoid UB, this should be rigourous.

The problem manifested as an OutOfSpec error mapping zero length FixedSizeBinaryArray

This fix uses the DataType to determine the row length.

jorgecarleitao commented 1 year ago

Thank you @andy-thomason for this PR and well spotted! 🙇

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 85.71% and project coverage change: -0.02 :warning:

Comparison is base (73ed7c8) 83.45% compared to head (5e2c52b) 83.43%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1454 +/- ## ========================================== - Coverage 83.45% 83.43% -0.02% ========================================== Files 376 376 Lines 41161 41166 +5 ========================================== - Hits 34350 34346 -4 - Misses 6811 6820 +9 ``` | [Impacted Files](https://codecov.io/gh/jorgecarleitao/arrow2/pull/1454?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jorge+Leitao) | Coverage Δ | | |---|---|---| | [src/io/ipc/read/error.rs](https://codecov.io/gh/jorgecarleitao/arrow2/pull/1454?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jorge+Leitao#diff-c3JjL2lvL2lwYy9yZWFkL2Vycm9yLnJz) | `100.00% <ø> (ø)` | | | [src/mmap/array.rs](https://codecov.io/gh/jorgecarleitao/arrow2/pull/1454?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jorge+Leitao#diff-c3JjL21tYXAvYXJyYXkucnM=) | `96.52% <85.71%> (-0.19%)` | :arrow_down: | ... and [4 files with indirect coverage changes](https://codecov.io/gh/jorgecarleitao/arrow2/pull/1454/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jorge+Leitao) Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jorge+Leitao). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jorge+Leitao)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.