Skip to content

Commit

Permalink
dealing with all cases of reliance on uncomputed sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed May 3, 2023
1 parent f8e74e9 commit d0cd877
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
12 changes: 8 additions & 4 deletions crates/re_arrow_store/tests/internals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,24 @@ fn pathological_bucket_topology() {

let timepoint = TimePoint::from([build_frame_nr(frame_nr.into())]);
for _ in 0..num {
let row = DataRow::from_cells1(
let mut row = DataRow::from_cells1(
RowId::random(),
ent_path.clone(),
timepoint.clone(),
num_instances,
build_some_instances(num_instances as _),
);
row.compute_all_size_bytes();
store_forward.insert_row(&row).unwrap();

let row = DataRow::from_cells1(
let mut row = DataRow::from_cells1(
RowId::random(),
ent_path.clone(),
timepoint.clone(),
num_instances,
build_some_instances(num_instances as _),
);
row.compute_all_size_bytes();
store_backward.insert_row(&row).unwrap();
}
}
Expand All @@ -83,13 +85,15 @@ fn pathological_bucket_topology() {
let rows = range
.map(|frame_nr| {
let timepoint = TimePoint::from([build_frame_nr(frame_nr.into())]);
DataRow::from_cells1(
let mut row = DataRow::from_cells1(
RowId::random(),
ent_path.clone(),
timepoint,
num_instances,
build_some_instances(num_instances as _),
)
);
row.compute_all_size_bytes();
row
})
.collect::<Vec<_>>();

Expand Down
2 changes: 1 addition & 1 deletion crates/re_log_types/src/data_cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ fn data_cell_sizes() {
use arrow2::array::UInt64Array;

// not computed
{
if !cfg!(debug_assertions) {
let cell = DataCell::from_arrow(InstanceKey::name(), UInt64Array::from_vec(vec![]).boxed());
assert_eq!(0, cell.heap_size_bytes());
assert_eq!(0, cell.heap_size_bytes());
Expand Down
13 changes: 9 additions & 4 deletions crates/re_log_types/src/data_table_batcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,8 @@ mod tests {
let batcher = DataTableBatcher::new(DataTableBatcherConfig::NEVER).unwrap();
let tables = batcher.tables();

let expected = create_table();
let mut expected = create_table();
expected.compute_all_size_bytes();

for _ in 0..3 {
assert_eq!(Err(TryRecvError::Empty), tables.try_recv());
Expand Down Expand Up @@ -507,7 +508,9 @@ mod tests {
let batcher = DataTableBatcher::new(DataTableBatcherConfig::NEVER).unwrap();
let tables = batcher.tables();

let rows = create_table().to_rows().collect_vec();
let mut table = create_table();
table.compute_all_size_bytes();
let rows = table.to_rows().collect_vec();

for _ in 0..3 {
assert_eq!(Err(TryRecvError::Empty), tables.try_recv());
Expand Down Expand Up @@ -608,7 +611,8 @@ mod tests {

#[test]
fn num_rows_trigger() {
let table = create_table();
let mut table = create_table();
table.compute_all_size_bytes();

let rows = table.to_rows().collect_vec();
let flush_duration = std::time::Duration::from_millis(50);
Expand Down Expand Up @@ -667,7 +671,8 @@ mod tests {

#[test]
fn duration_trigger() {
let table = create_table();
let mut table = create_table();
table.compute_all_size_bytes();
let rows = table.to_rows().collect_vec();

let flush_duration = Duration::from_millis(50);
Expand Down

0 comments on commit d0cd877

Please sign in to comment.