Skip to content

Commit 2ce0cc5

Browse files
committed
clarify comments
Signed-off-by: Andrew Duffy <andrew@a10y.dev>
1 parent 54f9f06 commit 2ce0cc5

File tree

1 file changed

+6
-6
lines changed
  • vortex-array/src/arrays/patched/vtable

1 file changed

+6
-6
lines changed

vortex-array/src/arrays/patched/vtable/slice.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,24 @@ use crate::arrays::PatchedArray;
1313
use crate::arrays::slice::SliceReduce;
1414
use crate::stats::ArrayStats;
1515

16-
/// Is this something that uses a SliceKernel or a SliceReduce
1716
impl SliceReduce for Patched {
1817
fn slice(array: &Self::Array, range: Range<usize>) -> VortexResult<Option<ArrayRef>> {
19-
// We **always** slice at 1024-element chunk boundaries. We keep the offset + len
18+
// We **always** slice the patches at 1024-element chunk boundaries. We keep the offset + len
2019
// around so that when we execute we know how much to chop off.
2120
let new_offset = (range.start + array.offset) % 1024;
2221
let new_len = range.end - range.start;
2322

2423
let chunk_start = (range.start + array.offset) / 1024;
2524
let chunk_stop = (range.end + array.offset).div_ceil(1024);
26-
27-
let inner = array.inner.slice(range.start..range.end)?;
28-
29-
// Slice to only maintain offsets to the sliced chunks
3025
let sliced_lane_offsets = array
3126
.lane_offsets
3227
.slice((chunk_start * array.n_lanes)..(chunk_stop * array.n_lanes) + 1)?;
3328

29+
// Unlike the patches, we slice the inner to the exact range. This is handled
30+
// at execution time by making sure to skip patch indices that are < offset
31+
// or >= len.
32+
let inner = array.inner.slice(range.start..range.end)?;
33+
3434
Ok(Some(
3535
PatchedArray {
3636
inner,

0 commit comments

Comments
 (0)