Skip to content

Commit

Permalink
Fix Chunk::component_batch_raw not checking the bitmap first (#7286)
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc authored Aug 27, 2024
1 parent ae42c69 commit e13b389
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions crates/store/re_chunk/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,17 @@ impl Chunk {
component_name: &ComponentName,
row_index: usize,
) -> Option<ChunkResult<Box<dyn ArrowArray>>> {
self.components.get(component_name).map(|list_array| {
self.components.get(component_name).and_then(|list_array| {
if list_array.len() > row_index {
Ok(list_array.value(row_index))
list_array
.is_valid(row_index)
.then(|| Ok(list_array.value(row_index)))
} else {
Err(crate::ChunkError::IndexOutOfBounds {
Some(Err(crate::ChunkError::IndexOutOfBounds {
kind: "row".to_owned(),
len: list_array.len(),
index: row_index,
})
}))
}
})
}
Expand Down Expand Up @@ -258,7 +260,7 @@ impl UnitChunkShared {
debug_assert!(self.num_rows() == 1);
self.components
.get(component_name)
.map(|list_array| list_array.value(0))
.and_then(|list_array| list_array.is_valid(0).then(|| list_array.value(0)))
}

/// Returns the deserialized data for the specified component.
Expand Down

0 comments on commit e13b389

Please sign in to comment.