-
Notifications
You must be signed in to change notification settings - Fork 394
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 (#8656)
Also added a regression test * Part of #3741 --------- Co-authored-by: Clement Rey <[email protected]>
- Loading branch information
Showing
12 changed files
with
129 additions
and
43 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,48 @@ | ||
use std::sync::Arc; | ||
|
||
use re_chunk::{Chunk, ChunkId, RowId}; | ||
use re_chunk_store::ChunkStore; | ||
use re_log_types::{ | ||
build_frame_nr, build_log_time, | ||
example_components::{MyColor, MyIndex}, | ||
EntityPath, Time, | ||
}; | ||
use re_types_core::ComponentBatch as _; | ||
|
||
/// 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 chunk_id = ChunkId::from_u128(123_456_789_123_456_789_123_456_789); | ||
let row_id = RowId::from_u128(32_033_410_000_000_000_000_000_000_123); | ||
|
||
store.insert_chunk(&Arc::new( | ||
Chunk::builder_with_id(chunk_id, entity_path.clone()) | ||
.with_serialized_batches( | ||
row_id, | ||
[ | ||
build_frame_nr(1), | ||
build_log_time(Time::from_ns_since_epoch(1_736_534_622_123_456_789)), | ||
], | ||
[indices1.try_serialized()?, colors1.try_serialized()?], | ||
) | ||
.build()?, | ||
))?; | ||
|
||
insta::assert_snapshot!("format_chunk_store", store.to_string()); | ||
|
||
Ok(()) | ||
} |
33 changes: 33 additions & 0 deletions
33
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,33 @@ | ||
--- | ||
source: crates/store/re_chunk_store/tests/formatting.rs | ||
expression: store.to_string() | ||
--- | ||
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.0 KiB | ||
num_rows: 1 | ||
num_events: 2 | ||
} | ||
chunks: [ | ||
┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ | ||
│ CHUNK METADATA: │ | ||
│ * entity_path: "/this/that" │ | ||
│ * heap_size_bytes: "838" │ | ||
│ * id: "661EFDF2E3B19F7C045F15" │ | ||
│ * is_sorted: "" │ | ||
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤ | ||
│ ┌──────────────────────────────────┬───────────────┬───────────────────────────────┬───────────────────┬───────────────────┐ │ | ||
│ │ 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
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