From 6c2ec286b53cbc583547684685d03bab8f603978 Mon Sep 17 00:00:00 2001 From: Robert Kruszewski Date: Thu, 21 Nov 2024 17:18:37 +0000 Subject: [PATCH] fix: Stop producing empty row masks in chunked reader (#1429) --- vortex-file/src/read/buffered.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vortex-file/src/read/buffered.rs b/vortex-file/src/read/buffered.rs index a5e8499aa4..e89687f97e 100644 --- a/vortex-file/src/read/buffered.rs +++ b/vortex-file/src/read/buffered.rs @@ -28,7 +28,8 @@ impl BufferedLayoutReader { // TODO(robert): Support out of order reads fn buffer_read(&mut self, mask: &RowMask) -> VortexResult>> { while let Some(((begin, end), layout)) = self.layouts.pop_front() { - if mask.end() > begin && mask.begin() <= end { + // Since ends are exclusive there's only overlap if either end is larger/smaller by at least 1 + if mask.end() > begin && mask.begin() < end { self.layouts.push_front(((begin, end), layout)); break; } @@ -36,7 +37,7 @@ impl BufferedLayoutReader { while let Some(((begin, end), mut layout)) = self.layouts.pop_front() { // This selection doesn't know about rows in this chunk, we should put it back and wait for another request with different range - if mask.end() <= begin || mask.begin() > end { + if mask.end() <= begin || mask.begin() >= end { self.layouts.push_front(((begin, end), layout)); return Ok(None); }