Skip to content

Commit

Permalink
Time panel chunkification (rerun-io#6934)
Browse files Browse the repository at this point in the history
Co-authored-by: Clement Rey <[email protected]>
  • Loading branch information
jprochazk and teh-cmc authored Jul 23, 2024
1 parent 763fc0e commit f7d9e1c
Show file tree
Hide file tree
Showing 33 changed files with 802 additions and 1,448 deletions.
16 changes: 8 additions & 8 deletions crates/store/re_chunk/src/chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,14 @@ impl Chunk {
//
// TODO(cmc): This needs to be stored in chunk metadata and transported across IPC.
#[inline]
pub fn num_events_cumulative(&self) -> usize {
pub fn num_events_cumulative(&self) -> u64 {
// Reminder: component columns are sparse, we must take a look at the validity bitmaps.
self.components
.values()
.map(|list_array| {
list_array.validity().map_or_else(
|| list_array.len(),
|validity| validity.len() - validity.unset_bits(),
|| list_array.len() as u64,
|validity| validity.len() as u64 - validity.unset_bits() as u64,
)
})
.sum()
Expand All @@ -254,7 +254,7 @@ impl Chunk {
re_tracing::profile_function!();

if self.is_static() {
return vec![(TimeInt::STATIC, self.num_events_cumulative() as u64)];
return vec![(TimeInt::STATIC, self.num_events_cumulative())];
}

let Some(time_chunk) = self.timelines().get(timeline) else {
Expand All @@ -263,7 +263,7 @@ impl Chunk {

let time_range = time_chunk.time_range();
if time_range.min() == time_range.max() {
return vec![(time_range.min(), self.num_events_cumulative() as u64)];
return vec![(time_range.min(), self.num_events_cumulative())];
}

let counts = if time_chunk.is_sorted() {
Expand Down Expand Up @@ -363,12 +363,12 @@ impl Chunk {
//
// TODO(cmc): This needs to be stored in chunk metadata and transported across IPC.
#[inline]
pub fn num_events_for_component(&self, component_name: ComponentName) -> Option<usize> {
pub fn num_events_for_component(&self, component_name: ComponentName) -> Option<u64> {
// Reminder: component columns are sparse, we must check validity bitmap.
self.components.get(&component_name).map(|list_array| {
list_array.validity().map_or_else(
|| list_array.len(),
|validity| validity.len() - validity.unset_bits(),
|| list_array.len() as u64,
|validity| validity.len() as u64 - validity.unset_bits() as u64,
)
})
}
Expand Down
Loading

0 comments on commit f7d9e1c

Please sign in to comment.