Skip to content

Commit

Permalink
Change rerun rrd print to use ChunkBatches for formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Feb 25, 2025
1 parent 81c8eb4 commit f90e331
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions crates/top/rerun/src/commands/rrd/print.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use itertools::Itertools;

use re_byte_size::SizeBytes as _;
use re_log_types::{LogMsg, SetStoreInfo};
use re_sdk::log::Chunk;

use crate::commands::read_rrd_streams_from_file_or_stdin;

Expand Down Expand Up @@ -81,31 +80,32 @@ fn print_msg(verbose: u8, msg: LogMsg) -> anyhow::Result<()> {
}

LogMsg::ArrowMsg(_row_id, arrow_msg) => {
let chunk = Chunk::from_arrow_msg(&arrow_msg).context("skipped corrupt chunk")?;
let chunk =
re_sorbet::ChunkBatch::try_from(&arrow_msg.batch).context("corrupt chunk")?;

print!(
"Chunk({}) with {} rows ({}) - {:?} - ",
chunk.id(),
chunk.chunk_id(),
chunk.num_rows(),
re_format::format_bytes(chunk.total_size_bytes() as _),
chunk.entity_path(),
);

if verbose == 0 {
let column_names = chunk
.component_names()
.map(|name| name.short_name())
.component_columns()
.map(|(descr, _)| descr.component_name.short_name())
.join(" ");
println!("columns: [{column_names}]");
} else if verbose == 1 {
let column_descriptors = chunk
.component_descriptors()
.map(|descr| descr.short_name())
.component_columns()
.map(|(descr, _)| descr.to_string())
.collect_vec()
.join(" ");
println!("columns: [{column_descriptors}]",);
} else if verbose == 2 {
println!("\n{}", chunk.emptied()); // headers only
println!("\n{}", chunk.drop_all_rows()); // headers only
} else {
println!("\n{chunk}");
}
Expand Down

0 comments on commit f90e331

Please sign in to comment.