Skip to content

Commit 7310b2d

Browse files
authored
performance: Avoid intersecting ranges multiple times in scan (#4578)
Signed-off-by: Robert Kruszewski <github@robertk.io>
1 parent 2f6cb6d commit 7310b2d

1 file changed

Lines changed: 2 additions & 10 deletions

File tree

vortex-scan/src/lib.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,7 @@ impl<A: 'static + Send> ScanBuilder<A> {
202202
return Ok(vec![]);
203203
}
204204

205-
let row_range = self.row_range.clone();
206-
self.prepare()?.execute(row_range)
205+
self.prepare()?.execute(None)
207206
}
208207

209208
/// Returns a [`Stream`](futures::Stream) with tasks spawned onto the current Tokio runtime.
@@ -217,8 +216,7 @@ impl<A: 'static + Send> ScanBuilder<A> {
217216
pub fn into_tokio_stream(
218217
self,
219218
) -> VortexResult<impl futures::Stream<Item = VortexResult<A>> + Send + 'static + use<A>> {
220-
let row_range = self.row_range.clone();
221-
self.prepare()?.execute_tokio_stream(row_range)
219+
self.prepare()?.execute_tokio_stream(None)
222220
}
223221
}
224222

@@ -378,8 +376,6 @@ impl<A: 'static + Send> RepeatedScan<A> {
378376
&self,
379377
row_range: Option<Range<u64>>,
380378
) -> VortexResult<impl futures::Stream<Item = VortexResult<A>> + Send + 'static + use<A>> {
381-
let row_range = intersect_ranges(self.row_range.as_ref(), row_range);
382-
383379
use futures::StreamExt;
384380
use vortex_error::vortex_err;
385381

@@ -402,8 +398,6 @@ impl RepeatedScan<ArrayRef> {
402398
&self,
403399
row_range: Option<Range<u64>>,
404400
) -> VortexResult<impl ArrayIterator + Send + Clone + 'static> {
405-
let row_range = intersect_ranges(self.row_range.as_ref(), row_range);
406-
407401
let dtype = self.dtype.clone();
408402
let tasks = self.execute(row_range)?;
409403
let queue = WorkStealingQueue::new([Box::new(move || Ok(tasks)) as TaskFactory<ArrayTask>]);
@@ -420,8 +414,6 @@ impl RepeatedScan<ArrayRef> {
420414
&self,
421415
row_range: Option<Range<u64>>,
422416
) -> VortexResult<impl vortex_array::stream::ArrayStream + Send + 'static> {
423-
let row_range = intersect_ranges(self.row_range.as_ref(), row_range);
424-
425417
let dtype = self.dtype.clone();
426418
let stream = self.execute_tokio_stream(row_range)?;
427419
Ok(vortex_array::stream::ArrayStreamAdapter::new(dtype, stream))

0 commit comments

Comments
 (0)