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

Commit

Permalink
Fixed error in computing projection in `io::ipc::read::reader::FileRe…
Browse files Browse the repository at this point in the history
…ader` (#596)
  • Loading branch information
illumination-k authored Nov 10, 2021
1 parent a2c914b commit 3caa204
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/io/ipc/read/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,11 @@ 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.iter().fold(0, |mut acc, v| {
projection.windows(2).for_each(|x| {
assert!(
*v > acc,
x[0] < x[1],
"The projection on IPC must be ordered and non-overlapping"
);
acc = *v;
acc
});
}
let projection = projection.map(|projection| {
Expand Down
2 changes: 1 addition & 1 deletion tests/it/io/ipc/read/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,5 +178,5 @@ fn test_projection(version: &str, file_name: &str, column: usize) -> Result<()>
fn read_projected() -> Result<()> {
test_projection("1.0.0-littleendian", "generated_primitive", 1)?;
test_projection("1.0.0-littleendian", "generated_dictionary", 2)?;
test_projection("1.0.0-littleendian", "generated_nested", 1)
test_projection("1.0.0-littleendian", "generated_nested", 0)
}

0 comments on commit 3caa204

Please sign in to comment.