-
Notifications
You must be signed in to change notification settings - Fork 377
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix formatting of RowId/Tuid when printing ChunkStore
- Loading branch information
Showing
11 changed files
with
114 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
use std::sync::Arc; | ||
|
||
use re_chunk::{Chunk, RowId}; | ||
use re_chunk_store::ChunkStore; | ||
use re_log_types::{ | ||
build_frame_nr, build_log_time, | ||
example_components::{MyColor, MyIndex}, | ||
EntityPath, Time, | ||
}; | ||
|
||
/// Ensure that `ChunkStore::to_string()` is nice and readable. | ||
#[test] | ||
fn format_chunk_store() -> anyhow::Result<()> { | ||
re_log::setup_logging(); | ||
|
||
let mut store = ChunkStore::new( | ||
re_log_types::StoreId::from_string( | ||
re_log_types::StoreKind::Recording, | ||
"test_id".to_owned(), | ||
), | ||
Default::default(), | ||
); | ||
|
||
let entity_path = EntityPath::from("this/that"); | ||
|
||
let (indices1, colors1) = (MyIndex::from_iter(0..3), MyColor::from_iter(0..3)); | ||
|
||
let row_id = RowId::from_u128(32_033_410_000_000_000_000_000_000_123); | ||
|
||
store.insert_chunk(&Arc::new( | ||
Chunk::builder(entity_path.clone()) | ||
.with_component_batches( | ||
row_id, | ||
[ | ||
build_frame_nr(1), | ||
build_log_time(Time::from_ns_since_epoch(1_736_534_622_123_456_789)), | ||
], | ||
[&indices1 as _, &colors1 as _], | ||
) | ||
.build()?, | ||
))?; | ||
|
||
insta::assert_snapshot!("format_chunk_store", store.to_string()); | ||
|
||
Ok(()) | ||
} |
35 changes: 35 additions & 0 deletions
35
crates/store/re_chunk_store/tests/snapshots/formatting__format_chunk_store.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
source: crates/store/re_chunk_store/tests/formatting.rs | ||
assertion_line: 43 | ||
expression: store.to_string() | ||
snapshot_kind: text | ||
--- | ||
ChunkStore { | ||
id: test_id | ||
config: ChunkStoreConfig { enable_changelog: true, chunk_max_bytes: 393216, chunk_max_rows: 4096, chunk_max_rows_if_unsorted: 1024 } | ||
stats: { | ||
num_chunks: 1 | ||
total_size_bytes: 1.1 KiB | ||
num_rows: 1 | ||
num_events: 2 | ||
} | ||
chunks: [ | ||
┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ | ||
│[3m CHUNK METADATA: [0m│ | ||
│[3m * entity_path: "/this/that" [0m│ | ||
│[3m * heap_size_bytes: "934" [0m│ | ||
│[3m * id: "18196B315017D6D07289B50E31531230" [0m│ | ||
│[3m * is_sorted: "" [0m│ | ||
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤ | ||
│ ┌──────────────────────────────────┬───────────────┬───────────────────────────────┬───────────────────┬───────────────────┐ │ | ||
│ │ RowId ┆ frame_nr ┆ log_time ┆ example.MyColor ┆ example.MyIndex │ │ | ||
│ │ --- ┆ --- ┆ --- ┆ --- ┆ --- │ │ | ||
│ │ type: "struct[2]" ┆ type: "i64" ┆ type: "timestamp(ns)" ┆ type: "list[u32]" ┆ type: "list[u64]" │ │ | ||
│ │ ARROW:extension:name: "TUID" ┆ is_sorted: "" ┆ is_sorted: "" ┆ kind: "data" ┆ kind: "data" │ │ | ||
│ │ kind: "control" ┆ kind: "time" ┆ kind: "time" ┆ ┆ │ │ | ||
│ ╞══════════════════════════════════╪═══════════════╪═══════════════════════════════╪═══════════════════╪═══════════════════╡ │ | ||
│ │ 0000000067816A6BB4B8C1254D40007B ┆ 1 ┆ 2025-01-10 18:43:42.123456789 ┆ [0, 1, 2] ┆ [0, 1, 2] │ │ | ||
│ └──────────────────────────────────┴───────────────┴───────────────────────────────┴───────────────────┴───────────────────┘ │ | ||
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters