Skip to content

Commit c2303e5

Browse files
connortsui20a10y
andauthored
Docs: document chunk_offsets in Patches (#5429)
Signed-off-by: Connor Tsui <[email protected]> Co-authored-by: Andrew Duffy <[email protected]>
1 parent df9edda commit c2303e5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

vortex-array/src/patches.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,19 @@ pub struct Patches {
111111
indices: ArrayRef,
112112
values: ArrayRef,
113113
/// Stores the patch index offset for each chunk.
114+
///
115+
/// This allows us to lookup the patches for a given chunk in constant time via
116+
/// `patch_indices[chunk_offsets[i]..chunk_offsets[i+1]]`.
117+
///
118+
/// This is optional for compatibility reasons.
114119
chunk_offsets: Option<ArrayRef>,
115120
/// Chunk offsets are only sliced off in case the slice is fully
116121
/// outside of the chunk range.
117122
///
118123
/// Though the range for indices and values is sliced in terms of
119124
/// individual elements, not chunks. To account for that we do a
120125
/// saturating sub when adjusting the indices based on the chunk offset.
121-
//
126+
///
122127
/// `offset_within_chunk` is necessary in order to keep track of how many
123128
/// elements were sliced off within the chunk.
124129
offset_within_chunk: Option<usize>,

0 commit comments

Comments
 (0)