Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Fixed error in computing projection in io::ipc::read::reader::FileReader #596

Merged

Conversation

illumination-k
Copy link
Contributor

Allow projection to be set to 0 in io::ipc::read::reader::FileReader::new by using windows(2).
modified it according to this comment

close #594

@@ -236,7 +236,7 @@ impl<R: Read + Seek> FileReader<R> {
/// Panics iff the projection is not in increasing order (e.g. `[1, 0]` nor `[0, 1, 1]` are valid)
pub fn new(reader: R, metadata: FileMetadata, projection: Option<Vec<usize>>) -> Self {
if let Some(projection) = projection.as_ref() {
let _ = projection.windows(2).for_each(|x| {
projection.windows(2).for_each(|x| {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks wonderful! Maybe we can add a test for this to make sure it doesn't panic now?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pointer for the tests: /~https://github.com/jorgecarleitao/arrow2/blob/main/tests/it/io/ipc/read/file.rs#L181 (changing from 1 to 0 should be enough :) )

@codecov
Copy link

codecov bot commented Nov 10, 2021

Codecov Report

Merging #596 (83b8db0) into main (add3e2a) will decrease coverage by 0.00%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #596      +/-   ##
==========================================
- Coverage   79.16%   79.15%   -0.01%     
==========================================
  Files         400      400              
  Lines       24892    24890       -2     
==========================================
- Hits        19705    19701       -4     
- Misses       5187     5189       +2     
Impacted Files Coverage Δ
src/io/ipc/read/reader.rs 68.50% <50.00%> (-2.04%) ⬇️
tests/it/io/ipc/read/file.rs 100.00% <100.00%> (ø)
src/io/ipc/read/array/list.rs 25.00% <0.00%> (-18.75%) ⬇️
src/io/ipc/read/deserialize.rs 35.89% <0.00%> (ø)
src/bitmap/utils/slice_iterator.rs 92.53% <0.00%> (+1.49%) ⬆️
src/io/ipc/read/array/fixed_size_list.rs 45.83% <0.00%> (+20.83%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update add3e2a...83b8db0. Read the comment docs.

@jorgecarleitao jorgecarleitao added the bug Something isn't working label Nov 10, 2021
@jorgecarleitao jorgecarleitao changed the title Allow projection to be set to 0 in io::ipc::read::reader::FileReader::new Fixed error in computing projection in io::ipc::read::reader::FileReader Nov 10, 2021
@jorgecarleitao jorgecarleitao merged commit 3caa204 into jorgecarleitao:main Nov 10, 2021
@illumination-k illumination-k deleted the set-0-ipc-projection branch November 11, 2021 01:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

arrow2::io::ipc::read::reader::FileReader cannot set 0 as projection
3 participants