diff --git a/src/io/ipc/read/reader.rs b/src/io/ipc/read/reader.rs index 0f025e4451c..e9a8328cfde 100644 --- a/src/io/ipc/read/reader.rs +++ b/src/io/ipc/read/reader.rs @@ -236,13 +236,11 @@ impl FileReader { /// 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>) -> 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| { diff --git a/tests/it/io/ipc/read/file.rs b/tests/it/io/ipc/read/file.rs index 602c4151a9a..c9f067ccc14 100644 --- a/tests/it/io/ipc/read/file.rs +++ b/tests/it/io/ipc/read/file.rs @@ -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) }